1
This commit is contained in:
parent
323005b8a3
commit
752377244d
@ -1278,6 +1278,28 @@ CREATE TABLE `t_user_honor` (
|
|||||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `t_inapp_record`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `t_inapp_record`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `t_inapp_record` (
|
||||||
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
|
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||||
|
`amount` bigint NOT NULL DEFAULT '0' COMMENT '充值总额',
|
||||||
|
`buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '充值次数',
|
||||||
|
`amount_ok` bigint NOT NULL DEFAULT '0' COMMENT '充值成功总额',
|
||||||
|
`buy_ok_times` int(11) NOT NULL DEFAULT '0' COMMENT '充值成功次数',
|
||||||
|
`daytime` int(11) NOT NULL DEFAULT '0' COMMENT '时间',
|
||||||
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`idx`),
|
||||||
|
KEY `account_id` (`account_id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `t_inapp_order`
|
-- Table structure for table `t_inapp_order`
|
||||||
--
|
--
|
||||||
|
81
webapp/models/InAppRecord.php
Normal file
81
webapp/models/InAppRecord.php
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace models;
|
||||||
|
|
||||||
|
use mt;
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
|
||||||
|
class InPppRecord extends BaseModel {
|
||||||
|
|
||||||
|
public static function get()
|
||||||
|
{
|
||||||
|
$row = SqlHelper::ormSelectOne(
|
||||||
|
myself()->_getSelfMysql(),
|
||||||
|
't_inapp_record',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'daytime' => myself()->_getNowDaySeconds()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function addAmount($amount)
|
||||||
|
{
|
||||||
|
SqlHelper::upsert(
|
||||||
|
myself()->_getSelfMysql(),
|
||||||
|
't_inapp_record',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'daytime' => myself()->_getNowDaySeconds()
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'amount' => function () use($amount) {
|
||||||
|
return 'amount + ' + $amount;
|
||||||
|
},
|
||||||
|
'buy_times' => function () {
|
||||||
|
return 'buy_times + 1';
|
||||||
|
},
|
||||||
|
'modifytime' => myself()->_getNowTime(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'amount' => $amount,
|
||||||
|
'buy_times' => 1,
|
||||||
|
'daytime' => myself()->_getNowDaySeconds(),
|
||||||
|
'createtime' => myself()->_getNowTime(),
|
||||||
|
'modifytime' => myself()->_getNowTime(),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function addAmountOk($accountId, $amount)
|
||||||
|
{
|
||||||
|
SqlHelper::upsert(
|
||||||
|
myself()->_getMysql($accountId),
|
||||||
|
't_inapp_record',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'daytime' => myself()->_getNowDaySeconds()
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'amount_ok' => function () use($amount) {
|
||||||
|
return 'amount_ok + ' + $amount;
|
||||||
|
},
|
||||||
|
'buy_ok_times' => function () use($amount) {
|
||||||
|
return 'buy_ok_times + 1';
|
||||||
|
},
|
||||||
|
'modifytime' => myself()->_getNowTime(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'amount_ok' => $amount,
|
||||||
|
'buy_ok_times' => 1,
|
||||||
|
'daytime' => myself()->_getNowDaySeconds(),
|
||||||
|
'createtime' => myself()->_getNowTime(),
|
||||||
|
'modifytime' => myself()->_getNowTime(),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user