12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace App\Console;
- use App\Console\Commands\Withdraw;
- use App\Console\Commands\OrderFinishFails;
- use App\Console\Commands\YesIntegral;
- use App\Events\RegisterApplyEvent;
- use App\Http\Controllers\QYInfo\QYInfoController;
- use App\Models\Address;
- use App\Models\Ordertest;
- use App\Models\Store;
- use App\Models\User;
- use Carbon\Carbon;
- use Illuminate\Console\Scheduling\Schedule;
- use Illuminate\Support\Facades\DB;
- use Laravel\Lumen\Console\Kernel as ConsoleKernel;
- use Illuminate\Support\Facades\Log;
- use mysql_xdevapi\Exception;
- use Qiniu\Auth as Auths;
- use Qiniu\Storage\UploadManager;
- use Qiniu\Storage\BucketManager;
- class Kernel extends ConsoleKernel
- {
- /**
- * The Artisan commands provided by your application.
- *
- * @var array
- */
- protected $commands = [
- ];
- /**
- * Define the application's command schedule.
- *
- * @param \Illuminate\Console\Scheduling\Schedule $schedule
- * @return void
- */
- protected function schedule(Schedule $schedule)
- {
- //没审核的3天后提醒一次
- $schedule->call(function (){
- $dayTime1=date("Y-m-d 00:00:00",strtotime("-3 days"));
- $dayTime2=date("Y-m-d 23:59:59",strtotime("-3 days"));
- $users = User::where('cert_status',2)->whereBetween('created_at',[$dayTime1,$dayTime2])->get();
- foreach($users as $key=>$val){
- $agent=User::where('id',$val->agent_id)->first();
- if($agent->openid){
- Log::info('-----'.$val->mobile.'------审核提醒1-----------'.$agent->openid);
- $mes['openid']=$agent->openid;
- $mes['data']=[
- 'first' => '注册信息已提交,请您及时审核',
- 'keyword1' => $val->nickname,
- 'keyword2' => $val->mobile,
- 'keyword3' => date("Y-m-d H:i"),
- 'remark' => '点击链接进入系统,查看详情',
- ];
- event(new RegisterApplyEvent($mes));
- }
- }
- })->dailyAt('10:00');
- }
- public function code($phone){
- $data=code($phone);
- $re=DB::table('users')->where('recom_code',$data)->first();
- if ($re){
- $data=$this->code($phone);
- return $data;
- }
- return $data;
- }
- public function auth_code($phone){
- $code_1=str_pad(random_int(1, 999), 3, 0, STR_PAD_LEFT);
- $code_2=mb_substr($phone,1,3);
- $code_3=str_pad(random_int(100, 99999), 6, 0, STR_PAD_LEFT);
- $code_4=mb_substr(time(),8,2);
- $code='DWBS00'.$code_1.date('ymd',time()).$code_2.$code_3.$code_4;
- $re=DB::table('users')->where('auth_code',$code)->first();
- if ($re){
- $code=$this->auth_code($phone);
- return $code;
- }
- return $code;
- }
- }
|