...
|
...
|
@@ -5,6 +5,7 @@ namespace app\index\controller; |
|
|
use addons\litestore\model\Litestoreorder;
|
|
|
use addons\third\model\Third;
|
|
|
use addons\wechat\library\Config as ConfigService;
|
|
|
use app\api\model\StoreInform;
|
|
|
use app\common\controller\Frontend;
|
|
|
use EasyWeChat\Foundation\Application as WXPAY_APP;
|
|
|
use EasyWeChat\Foundation\Application;
|
...
|
...
|
@@ -19,7 +20,7 @@ use think\Log; |
|
|
class Ajax extends Frontend
|
|
|
{
|
|
|
|
|
|
protected $noNeedLogin = ['lang','callback_for_wxgzh','store_notify','store_order_notify','notify','refund_notify'];
|
|
|
protected $noNeedLogin = ['lang','store_inform_over','callback_for_wxgzh','store_notify','store_order_notify','notify','refund_notify'];
|
|
|
protected $noNeedRight = ['*'];
|
|
|
protected $layout = '';
|
|
|
public function _initialize()
|
...
|
...
|
@@ -50,6 +51,47 @@ class Ajax extends Frontend |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 商圈信息红包过期
|
|
|
*/
|
|
|
public function store_inform_over()
|
|
|
{
|
|
|
$inform_model = new StoreInform();
|
|
|
$time = strtotime(date('Y-m-d',time())) - 14 * 86400;
|
|
|
$end_time = $time + 86400 - 14 * 86400;
|
|
|
$where = [
|
|
|
'type' => 1,
|
|
|
'status' => 2,
|
|
|
'surplus' => ['gt',0],
|
|
|
'updatetime' => ['between',[$time,$end_time]]
|
|
|
];
|
|
|
$inform = $inform_model->where($where)->select();
|
|
|
foreach ($inform as &$v) {
|
|
|
Db::startTrans();
|
|
|
$res = $inform_model->update(['id'=>$v['id'],'status'=>5]);
|
|
|
$user_model = new \app\admin\model\User();
|
|
|
$user = $user_model->where('id', $v['user_id'])->find();
|
|
|
// 积分变动记录
|
|
|
$log = [
|
|
|
'user_id' => $v['user_id'],
|
|
|
'score' => $v['score'],
|
|
|
'before' => $user['score'],
|
|
|
'after' => $user['score'] + $v['score'],
|
|
|
'createtime' => time(),
|
|
|
'status' => 3,
|
|
|
'memo' => '商圈信息过期'
|
|
|
];
|
|
|
$result_log = Db::name('user_score_log')->insertGetId($log);
|
|
|
// 返还用户余额
|
|
|
$result_user = $user_model->where('id', $user['id'])->setInc('score', $v['score']);
|
|
|
if(!$res || !$result_log || !$result_user) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
Db::commit();
|
|
|
}
|
|
|
echo 'success';
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 店铺申请回调
|
|
|
*/
|
|
|
public function store_notify()
|
...
|
...
|
|