123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?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 == 11 && $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,'积分清零');
- }
- }
- }
- }
|