支付意向 支付限额白名单
parent
9c8681466a
commit
ccd5970521
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Sdk\Model;
|
||||||
|
use Think\Model;
|
||||||
|
|
||||||
|
|
||||||
|
class PayChannelIntentionModel extends Model {
|
||||||
|
|
||||||
|
protected $_validate = array(
|
||||||
|
);
|
||||||
|
|
||||||
|
/* 自动完成规则 */
|
||||||
|
protected $_auto = array(
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造函数
|
||||||
|
* @param string $name 模型名称
|
||||||
|
* @param string $tablePrefix 表前缀
|
||||||
|
* @param mixed $connection 数据库连接信息
|
||||||
|
*/
|
||||||
|
public function __construct($name = '', $tablePrefix = '', $connection = '') {
|
||||||
|
/* 设置默认的表前缀 */
|
||||||
|
$this->tablePrefix ='tab_';
|
||||||
|
/* 执行构造方法 */
|
||||||
|
parent::__construct($name, $tablePrefix, $connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function paySubmit($orderId) {
|
||||||
|
if (!$orderId) return 0;
|
||||||
|
|
||||||
|
$log = $this->where(array(
|
||||||
|
'pay_order_number' => $orderId
|
||||||
|
))->order('id desc')->find();
|
||||||
|
|
||||||
|
if (!$log) return 0;
|
||||||
|
$this->where(array(
|
||||||
|
'id' => $log['id']
|
||||||
|
))->save(array(
|
||||||
|
'is_submit' => 1
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付成功
|
||||||
|
public function updatePaySuccess($orderId) {
|
||||||
|
$this->where(array(
|
||||||
|
'pay_order_number' => $orderId,
|
||||||
|
'pay_status' => 0
|
||||||
|
))->save(array(
|
||||||
|
'pay_status' => 1
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通知游戏成功
|
||||||
|
public function updateGameNotifySuccess($orderId) {
|
||||||
|
$this->where(array(
|
||||||
|
'pay_order_number' => $orderId,
|
||||||
|
'pay_game_status' => 0
|
||||||
|
))->save(array(
|
||||||
|
'pay_game_status' => 1
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Sdk\Model;
|
||||||
|
use Think\Model;
|
||||||
|
|
||||||
|
|
||||||
|
class UserPayWhitelistModel extends Model {
|
||||||
|
|
||||||
|
protected $_validate = array(
|
||||||
|
);
|
||||||
|
|
||||||
|
/* 自动完成规则 */
|
||||||
|
protected $_auto = array(
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造函数
|
||||||
|
* @param string $name 模型名称
|
||||||
|
* @param string $tablePrefix 表前缀
|
||||||
|
* @param mixed $connection 数据库连接信息
|
||||||
|
*/
|
||||||
|
public function __construct($name = '', $tablePrefix = '', $connection = '') {
|
||||||
|
/* 设置默认的表前缀 */
|
||||||
|
$this->tablePrefix ='tab_';
|
||||||
|
/* 执行构造方法 */
|
||||||
|
parent::__construct($name, $tablePrefix, $connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当前用户是否是有效白名单用户 reutrn 0无效 1有效
|
||||||
|
public function verify($userId) {
|
||||||
|
if (!$userId) return 0;
|
||||||
|
$user = $this->where(array(
|
||||||
|
'user_id' => $userId
|
||||||
|
))->find();
|
||||||
|
|
||||||
|
if (!$user) return 0;
|
||||||
|
|
||||||
|
if ($user['time'] == 1) return 1;
|
||||||
|
|
||||||
|
if ($user['update_time'] + $user['time'] > time()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue