1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace app\api\controller;
- use AlibabaCloud\Client\AlibabaCloud;
- use AlibabaCloud\Client\Exception\ClientException;
- use AlibabaCloud\Client\Exception\ServerException;
- use think\Db;
- /**
- * @title 定时任务
- * Class Timedtask
- * @controller Timedtask
- * @group base
- */
- class Timedtask
- {
- /**
- * @title 会员优惠券过期
- * @desc 会员优惠券过期
- * @author qc
- * @url /api/Timedtask/userCouponOver
- * @method GET
- */
- public function userCouponOver()
- {
- Db::table('user_coupon_list')
- ->where('past_at','> time',date('Y-m-d H:i:s'))
- ->where('status','=',1)
- ->update(['status'=>3]);
- }
- /**
- * @title 积分清零
- * @desc 积分清零
- * @author qc
- * @url /api/Timedtask/integralClean
- * @method GET
- */
- public function integralClean()
- {
- $month = date('m');
- $clean_set = sysconf('integral_clean');
- if($month == 1 && $clean_set != date('Y-m-d')) {
- Db::name('system_config')->where(['name'=>'integral_clean'])->update(['value'=>date('Y-m-d')]);
- $user_list = Db::name('store_member')->field('id,integral')->where('integral','>',0)->select();
- foreach ($user_list as $v) {
- update_user_integral($v['id'],$v['integral']*-1,10,'积分清零');
- }
- }
- }
- }
|