| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- declare (strict_types = 1);
- namespace app\api\command;
- use AlibabaCloud\SDK\OSS\OSS\SelectObjectRequest\body\selectRequest;
- use app\api\services\ThirdPayServices;
- use app\api\services\UserServices;
- use app\common\model\BoxMidHandleModel;
- use app\common\model\BoxModel;
- use app\common\model\CouponAreaModel;
- use app\common\model\CouponPlanLogModel;
- use app\common\model\CouponPlanModel;
- use app\common\model\ShopGoodsModel;
- use app\common\model\UserModel;
- use PhpOffice\PhpSpreadsheet\IOFactory;
- use think\console\Command;
- use think\console\Input;
- use think\console\Output;
- use think\db\Where;
- use think\Exception;
- use think\facade\Db;
- class AutoOpenBoxAction extends Command
- {
- protected function configure()
- {
- // 用户自动拆袋
- $this->setName('auto_open_box_action')
- ->setDescription('the auto_open_box_action command');
- }
- protected function execute(Input $input, Output $output)
- {
- Db::startTrans();
- try {
- $list = Db::name('box_mid_handle')->where('status', 1)->field('uid')->group('uid')->select();
- $model = new BoxMidHandleModel();
- foreach ($list as $key=>$val){
- $user_info = Db::name('user')->where('id', $val['uid'])->find();
- $model->openBoxOnline($val['uid'], [], $user_info);
- }
- Db::commit();
- }catch (\Exception $e){
- Db::rollback();
- return 22;
- }
- return 22;
- }
- }
|