This commit is contained in:
aozhiwei 2023-08-02 17:56:16 +08:00
parent db9cfb4586
commit 6e2d2bc88b
3 changed files with 208 additions and 241 deletions

View File

@ -20,12 +20,6 @@ class FirstTopupController extends BaseAuthedController
{
$complete = false;
// $address = myself()->_getAddress();
// if (!$address) {
// $this->_rspErr(1, 'you have not a web3 address');
// return;
// }
$conn = myself()->_getMysql('');
$status = $this->getStatusFromDB($conn);
@ -223,4 +217,5 @@ class FirstTopupController extends BaseAuthedController
break;
}
}
}

View File

@ -7,29 +7,31 @@ use phpcommon\SqlHelper;
class FirstTopup extends BaseModel {
public static function find()
public static function get()
{
$row = SqlHelper::ormSelectOne(
myself()->_getMysql(''),
myself()->_getSelfMysql(),
't_first_topup',
array(
'order_id' => $orderId,
'account_id' => myself()->_getAccountId(),
)
);
return $row;
}
public static function add($orderId, $platform, $goodsId, $price)
public static function add($accountId)
{
SqlHelper::insert(
myself()->_getMysql(''),
SqlHelper::upsert(
myself()->_getMysql($accountId),
't_first_topup',
array(
'order_id' => $orderId,
'account_id' => myself()->_getAccountId(),
'platform' => $platform,
'goods_id' => $goodsId,
'price' => $price,
'account_id' => $accountId,
),
array(
),
array(
'account_id' => $accountId,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
@ -39,10 +41,10 @@ class FirstTopup extends BaseModel {
public static function update($orderId, $fieldsKv)
{
SqlHelper::update(
myself()->_getMysql(''),
myself()->_getSelfMysql(),
't_first_topup',
array(
'order_id' => $orderId
'account_id' => myself()->_getAccountId()
),
$fieldsKv
);

View File

@ -7,6 +7,7 @@ require_once("mt/Item.php");
require_once("models/ShopBuyRecord.php");
require_once("models/OutAppOrder.php");
require_once("models/FirstTopup.php");
require_once("services/LogService.php");
require_once("ShopAddItemService.php");
@ -15,6 +16,7 @@ use phpcommon\SqlHelper;
use models\ShopBuyRecord;
use models\OutAppOrder;
use models\FirstTopup;
use services\LogService;
@ -68,7 +70,7 @@ class OutAppPurchase {
return;
}
OutAppOrder::markFinished($orderDb['order_id']);
$this->beginFirstTupop($address);
FirstTopup::add($accountId);
// 以下是看商品表中是否配置了充值额外奖励
$goodsMeta = mt\ShopGoods::get($orderDb['goods_id']);
if (!$goodsMeta) {
@ -99,38 +101,6 @@ class OutAppPurchase {
$this->_rspOk();
}
private function beginFirstTupop($address)
{
$conn = myself()->_getMysql('');
$exist = SqlHelper::selectOne(
$conn,
't_first_topup',
array('address'),
array('address' => $address)
);
if ($exist) {
return;
}
// 开始首充奖励活动进程
$chk = SqlHelper::insert(
$conn,
't_first_topup',
array(
'address' => $address,
'createtime' => myself()->_getNowTime(),
'status1' => 0,
'status2' => 0,
'status3' => 0,
)
);
if (!$chk) {
return;
}
}
private function verifySign()
{