“zq” 2 veckor sedan
förälder
incheckning
dd3a9e8d58

+ 89 - 0
app/Exports/BanzuiExcelExport.php

@@ -0,0 +1,89 @@
+<?php
+
+namespace App\Exports;
+
+use App\Models\User;
+use Illuminate\Support\Facades\Log;
+use Maatwebsite\Excel\Concerns\FromCollection;
+use Maatwebsite\Excel\Concerns\WithEvents;
+use Maatwebsite\Excel\Concerns\WithHeadings;
+use Maatwebsite\Excel\Concerns\WithTitle;
+use Maatwebsite\Excel\Events\AfterSheet;
+
+class BanzuiExcelExport implements FromCollection, WithHeadings, WithEvents
+{
+    protected $data;
+    public function __construct($data){
+        $this->data = $data;
+    }
+    public function collection()
+    {
+        return $this->data;
+    }
+
+
+    public function headings(): array
+    {
+        return['进货月份',
+'进货人(批发商)昵称',
+'进货人(批发商)手机号',
+'半醉浓香型件数',
+'半醉酱香型件数',
+'件数合计',
+'每件补助',
+'补助金额',
+'补助接收者昵称',
+'补助接收者手机号',
+'补助接收者身份'
+];
+    }
+
+    public function setRowHeight(array $rouHeight)
+    {
+        $this->RowHeight=$rouHeight;
+    }
+
+    public function registerEvents(): array
+    {
+        return [
+            AfterSheet::class => function(AfterSheet $event) {
+                // 合并单元格,从 A1 到 C1
+                $sheet = $event->sheet;
+//                $sheet->mergeCells('A1:C1');
+//                $sheet->setCellValue('A1','进货人信息');
+
+                // 设置字体加粗、居中等样式
+//                $sheet->getStyle('A1')->getFont()->setBold(true);
+//                $sheet->getStyle('A1')->getAlignment()->setHorizontal('center');
+//
+////                $sheet->mergeCells('D1:I1');
+////                $sheet->setCellValue('D1','进货数量及金额');
+//
+//                // 设置字体加粗、居中等样式
+//                $sheet->getStyle('D1')->getFont()->setBold(true);
+//                $sheet->getStyle('D1')->getAlignment()->setHorizontal('center');
+//
+////                $sheet->mergeCells('J1:L1');
+////                $sheet->setCellValue('J1','拿补助的人信息');
+//
+//
+//                // 设置字体加粗、居中等样式
+//                $sheet->getStyle('J1')->getFont()->setBold(true);
+//                $sheet->getStyle('J1')->getAlignment()->setHorizontal('center');
+//
+////                $sheet->mergeCells('M1:N1');
+////                $sheet->setCellValue('M1','补助明细及金额');
+//
+//                $sheet->getStyle('M1')->getFont()->setBold(true);
+//                $sheet->getStyle('M1')->getAlignment()->setHorizontal('center');
+//
+//                $sheet->getColumnDimension('B')->setWidth(20);
+//                $sheet->getColumnDimension('K')->setWidth(20);
+//                $sheet->setHeight=20;
+
+//                $sheet->getStyle('A:N')->getAlignment()->setHorizontal('center');
+                $sheet->getColumnDimension('A:K')->setWidth(20);
+            },
+        ];
+    }
+}

+ 26 - 0
app/Http/Controllers/AllExcelController.php

@@ -0,0 +1,26 @@
+<?php
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+
+class AllExcelController extends Controller{
+
+    public function getBanzui(Request $request){
+
+        $code=$request->input('reValue');
+        if (!$code){
+            return '<script>alert("没有权限")</script>';
+        }
+
+        $data=\DB::table('banzui')
+            ->where('code',$code)
+            ->get();
+        foreach ($data as $k=>$v){
+            $data[$k]['mobile']=mb_substr($v->mobile,0,3).'****'.mb_substr($v->mobile,-4);
+            $data[$k]['m_mobile']=mb_substr($v->mobile,0,3).'****'.mb_substr($v->mobile,-4);
+        }
+
+
+    }
+
+}

+ 11 - 0
app/Http/Controllers/LoginController.php

@@ -550,6 +550,13 @@ class LoginController extends Controller
         $sms = new EasySms(config('easysms'));
         $time = 10;
         $phone=$request->input('phone');
+        $info=DB::connection('mysql_zb')
+            ->table('banzui')
+            ->where('m_mobile',$phone)
+            ->first();
+        if (!$info){
+            return $this->error(50021,'','该手机号不存在!');
+        }
         $code=random_int(1111,9999);
         $area_code='+86';
         $number = new PhoneNumber($phone, $area_code);
@@ -582,6 +589,10 @@ class LoginController extends Controller
         }
         $value=Str::random(16);
         $expiredAt = Carbon::now()->addMinutes(10);
+        DB::connection('mysql_zb')
+            ->table('banzui')
+            ->where('m_mobile',$phone)
+            ->update(['code'=>$value]);
         $key=$value;
         Cache::put($key, [ 'value' => $value], $expiredAt);   // 缓存验证码 10分钟过期。::
         return $this->success($value);

BIN
public/.DS_Store