Browse Source

Merge branch 'liuxiangxin' into jun

jun 4 months ago
parent
commit
2dc543e275
98 changed files with 2805 additions and 922 deletions
  1. 70 0
      app/Console/Commands/CouponNotice.php
  2. 4 4
      app/Console/Commands/ProductDelist.php
  3. 1 1
      app/Console/Commands/Regiment.php
  4. 2 6
      app/Console/Commands/StaffRelation.php
  5. 2 6
      app/Console/Commands/StaffRemark.php
  6. 2 6
      app/Console/Commands/TagRelation.php
  7. 64 0
      app/Console/Commands/WeibanTaglist.php
  8. 4 0
      app/Console/Kernel.php
  9. 27 0
      app/Facades/Servers/Aliyun/Sms.php
  10. 1 1
      app/Facades/Servers/Encrypts/ApiSign.php
  11. 1 0
      app/Facades/Servers/WechatMini/Mini.php
  12. 2 1
      app/Facades/Servers/WeiBan/OpenApi.php
  13. 54 3
      app/Http/Controllers/Admin/CouponActive.php
  14. 24 0
      app/Http/Controllers/Admin/Custom.php
  15. 56 1
      app/Http/Controllers/Admin/LotteryOrder.php
  16. 582 576
      app/Http/Controllers/Admin/Orders.php
  17. 174 10
      app/Http/Controllers/Admin/Product.php
  18. 55 4
      app/Http/Controllers/Admin/RecruitmentActive.php
  19. 56 4
      app/Http/Controllers/Admin/ScoreClockinActive.php
  20. 128 1
      app/Http/Controllers/Admin/WeibanExternal.php
  21. 26 0
      app/Http/Controllers/Api/Custom.php
  22. 2 0
      app/Http/Controllers/Api/CustomAddr.php
  23. 4 0
      app/Http/Controllers/Api/CustomCoupon.php
  24. 35 4
      app/Http/Controllers/Api/Orders.php
  25. 35 18
      app/Http/Controllers/Api/Product.php
  26. 1 1
      app/Http/Controllers/Api/Score/Orders.php
  27. 14 73
      app/Http/Controllers/Api/Test.php
  28. 2 1
      app/Http/Requests/Admin/Custom.php
  29. 5 0
      app/Jobs/WeiBanSync.php
  30. 2 2
      app/Models/Custom.php
  31. 105 0
      app/Models/Custom/Shoptype.php
  32. 2 2
      app/Models/CustomAddr.php
  33. 1 1
      app/Models/Product.php
  34. 2 2
      app/Models/Product/Skus.php
  35. 85 0
      app/Models/WeiBan/Taglist.php
  36. 34 0
      app/Servers/Aliyun/Client.php
  37. 60 0
      app/Servers/Aliyun/Sms.php
  38. 20 0
      app/Servers/WechatMini/Mini.php
  39. 73 2
      app/Servers/WeiBan/OpenApi.php
  40. 1 0
      composer.json
  41. 553 1
      composer.lock
  42. 6 0
      config/aliyun.php
  43. 3 0
      public/static/Admin/css/components.css
  44. 1 1
      resources/views/admin/banner/index.blade.php
  45. 4 4
      resources/views/admin/business/add.blade.php
  46. 2 2
      resources/views/admin/business/edit.blade.php
  47. 7 7
      resources/views/admin/business/index.blade.php
  48. 4 4
      resources/views/admin/contact_way/index.blade.php
  49. 18 0
      resources/views/admin/coupon_active/get_poster.blade.php
  50. 4 1
      resources/views/admin/coupon_active/index.blade.php
  51. 2 2
      resources/views/admin/coupon_active_coupon/index.blade.php
  52. 2 2
      resources/views/admin/coupon_product/index.blade.php
  53. 2 2
      resources/views/admin/coupon_product_exclude/index.blade.php
  54. 2 2
      resources/views/admin/coupon_reward_product/index.blade.php
  55. 1 1
      resources/views/admin/coupon_reward_rule/index.blade.php
  56. 13 6
      resources/views/admin/custom/index.blade.php
  57. 5 5
      resources/views/admin/custom_clockin_record/index.blade.php
  58. 2 2
      resources/views/admin/custom_company/index.blade.php
  59. 18 0
      resources/views/admin/lottery_order/get_poster.blade.php
  60. 4 1
      resources/views/admin/lottery_order/index.blade.php
  61. 2 2
      resources/views/admin/lottery_order_product/index.blade.php
  62. 4 4
      resources/views/admin/lottery_order_record/index.blade.php
  63. 2 2
      resources/views/admin/lottery_order_reward/index.blade.php
  64. 1 1
      resources/views/admin/lottery_score/index.blade.php
  65. 4 4
      resources/views/admin/lottery_score_record/index.blade.php
  66. 2 2
      resources/views/admin/lottery_score_reward/index.blade.php
  67. 3 3
      resources/views/admin/orders/index.blade.php
  68. 1 1
      resources/views/admin/orders_banner/index.blade.php
  69. 1 1
      resources/views/admin/orders_receipt/index.blade.php
  70. 4 4
      resources/views/admin/orders_transport/index.blade.php
  71. 3 3
      resources/views/admin/producer/index.blade.php
  72. 12 8
      resources/views/admin/product/add.blade.php
  73. 29 19
      resources/views/admin/product/copy.blade.php
  74. 30 20
      resources/views/admin/product/edit.blade.php
  75. 22 0
      resources/views/admin/product/get_poster.blade.php
  76. 8 2
      resources/views/admin/product/get_sku_html.blade.php
  77. 9 9
      resources/views/admin/product/get_spec_html.blade.php
  78. 37 6
      resources/views/admin/product/index.blade.php
  79. 2 2
      resources/views/admin/product_spec/index.blade.php
  80. 1 1
      resources/views/admin/product_type/index.blade.php
  81. 2 2
      resources/views/admin/promo_product/index.blade.php
  82. 18 0
      resources/views/admin/recruitment_active/get_poster.blade.php
  83. 7 4
      resources/views/admin/recruitment_active/index.blade.php
  84. 5 5
      resources/views/admin/recruitment_record/index.blade.php
  85. 6 6
      resources/views/admin/regiment/index.blade.php
  86. 1 1
      resources/views/admin/regiment_active/add.blade.php
  87. 1 1
      resources/views/admin/regiment_active/edit.blade.php
  88. 6 6
      resources/views/admin/regiment_active/index.blade.php
  89. 6 6
      resources/views/admin/regiment_record/index.blade.php
  90. 18 0
      resources/views/admin/score_clockin_active/get_poster.blade.php
  91. 7 4
      resources/views/admin/score_clockin_active/index.blade.php
  92. 4 4
      resources/views/admin/score_product/index.blade.php
  93. 5 5
      resources/views/admin/stock/index.blade.php
  94. 12 6
      resources/views/admin/weiban_external/index.blade.php
  95. 39 0
      resources/views/admin/weiban_external/mark_tags.blade.php
  96. 1 1
      resources/views/admin/weiban_qrcode/index.blade.php
  97. 1 0
      routes/api.php
  98. 18 4
      routes/web.php

+ 70 - 0
app/Console/Commands/CouponNotice.php

@@ -0,0 +1,70 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+use App\Facades\Servers\Aliyun\Sms;
+use App\Models\CustomCoupon as Model;
+
+class CouponNotice extends Command
+{
+    /**
+     * 任务名称
+     *
+     * @var string
+     */
+    protected $signature = 'coupon_notice';
+
+    /**
+     * 任务描述
+     *
+     * @var string
+     */
+    protected $description = '优惠券到期提醒';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+		// 执行任务
+        $this->run_task();
+		return 0;
+    }
+
+    /**
+	 * 执行任务
+	 * 
+	 * */
+	public function run_task(){
+        // 实例化模型
+        $Model              = new Model();
+        // 获取三天后到期的优惠券->addDays(3)
+        $phoneList          = $Model->query()
+                            ->join('custom','custom_coupon.custom_uid','=','custom.uid')
+                            ->where([['custom_coupon.status','=',0],['custom_coupon.exp_time','>',now()->endOfDay()->getTimestamp()],['custom_coupon.exp_time','<',now()->addDays(2)->endOfDay()->getTimestamp()]])
+                            ->groupBy('custom.phone')
+                            ->limit(1000)
+                            ->pluck('custom.phone')
+                            ->toArray();
+        // 组合数据
+        $phoneList          = implode(',',$phoneList);
+        // 给这些手机号发送一条阿里云短信
+        $result             = Sms::sendSms($phoneList,'开邻智数','SMS_478125029');
+        // 返回结果
+        return              $result;
+	}
+
+}

+ 4 - 4
app/Console/Commands/ProductDelist.php

@@ -54,10 +54,10 @@ class ProductDelist extends Command
         $Model          = New Model();
 		// 限购自动下架
 		$Model->query()->where([['quota_end','>',0],['quota_end','<=',time()],['status','=',0]])->update(['status'=>1,'update_time'=>time()]);
-        // 自动上架
-		$Model->query()->where([['puton_time','>',0],['puton_time','<=',time()],['status','=',1],['putoff_time','>=',time()]])->update(['status'=>0,'update_time'=>time()]);
-        // 自动下架
-		$Model->query()->where([['putoff_time','>',0],['putoff_time','<=',time()],['status','=',0]])->update(['status'=>1,'update_time'=>time()]);
+        // 预上架的产品自动上架
+		$Model->query()->where([['puton_time','>',0],['puton_time','<=',time()],['status','=',2]])->update(['status'=>0,'update_time'=>time()]);
+        // 已上架并且需要自动下架的产品,自动下架
+		$Model->query()->where([['putoff_time','>',0],['putoff_time','<=',time()],['status','=',0]])->update(['status'=>4,'update_time'=>time()]);
 	}
 
 }

+ 1 - 1
app/Console/Commands/Regiment.php

@@ -128,7 +128,7 @@ class Regiment extends Command
                     $r = RegimentModel::query()->where('id','=',$v['id'])->update(['status'=>3]);
                     RegimentRecord::query()->where('regiment_id','=',$v['id'])->update(['status'=>3]);
                     //查询记录
-                    $regimentRecordList  =   regimentRecord::query()->where('regiment_id','=',$v['id'])->get();
+                    $regimentRecordList  =   regimentRecord::query()->where('regiment_id','=',$v['id'])->get()->toArray();
                     $regimentRecordListIds = array_column($regimentRecordList,'order_id');
                     //修改订单
                     $res         =   Orders::query()->whereIn('id',$regimentRecordListIds)->update(['status'=>11]);

+ 2 - 6
app/Console/Commands/StaffRelation.php

@@ -66,13 +66,9 @@ class StaffRelation extends Command
       // 返回结果
       if( !$task['id'] )	return ['error'=>'无执行任务'];
       // 获取列表
-      $userList           = OpenApi::getUserList($task['limit'],$task['offset'],$task['last_time']);
-      // 最后的更新时间
-      $lastTime           = 0;
+      $userList           = OpenApi::getUserList($task['limit'],$task['offset'],$task['last_time'],$source);
       // 放到队列执行
       foreach ($userList['user_list'] as $key=>$value) {
-          // 获取最后更新时间
-          $lastTime       = $value['updated_at'];
           // 外部联系人
           $value          = ['id'=>$value['id']];
           // 发送到队列执行,上锁成功则发送到队列执行
@@ -96,7 +92,7 @@ class StaffRelation extends Command
               // 状态结束
               $task['status']             = 1;
               // 最后的修改时间
-              $task['last_time']          = $lastTime - 1;
+              $task['last_time']          = time() - 1;
           }
       }
       // 修改任务情况

+ 2 - 6
app/Console/Commands/StaffRemark.php

@@ -66,13 +66,9 @@ class StaffRemark extends Command
       // 返回结果
       if( !$task['id'] )	return ['error'=>'无执行任务'];
       // 获取列表
-      $userList           = OpenApi::getUserList($task['limit'],$task['offset'],$task['last_time']);
-      // 最后的更新时间
-      $lastTime           = 0;
+      $userList           = OpenApi::getUserList($task['limit'],$task['offset'],$task['last_time'],$source);
       // 放到队列执行
       foreach ($userList['user_list'] as $key=>$value) {
-          // 获取最后更新时间
-          $lastTime       = $value['updated_at'];
           // 外部联系人
           $value          = ['id'=>$value['id']];
           // ['id'=>$value['id'],'name'=>$value['name'],'avatar'=>str_ireplace('http://','https://',(string)$value['avatar']),'gender'=>$value['gender'],'type'=>$value['type'],'corp_name'=>(string)$value['corp_name'],'corp_full_name'=>(string)$value['corp_full_name'],'insert_time'=>$value['created_at'],'update_time'=>$value['updated_at'],];
@@ -97,7 +93,7 @@ class StaffRemark extends Command
               // 状态结束
               $task['status']             = 1;
               // 最后的修改时间
-              $task['last_time']          = $lastTime - 1;
+              $task['last_time']          = time() - 1;
           }
       }
       // 修改任务情况

+ 2 - 6
app/Console/Commands/TagRelation.php

@@ -68,13 +68,9 @@ class TagRelation extends Command
       // 返回结果
       if( !$task['id'] )	return ['error'=>'无执行任务'];
       // 获取列表
-      $userList           = OpenApi::getUserList($task['limit'],$task['offset'],$task['last_time']);
-      // 最后的更新时间
-      $lastTime           = 0;
+      $userList           = OpenApi::getUserList($task['limit'],$task['offset'],$task['last_time'],$source);
       // 放到队列执行
       foreach ($userList['user_list'] as $key=>$value) {
-          // 获取最后更新时间
-          $lastTime       = $value['updated_at'];
           // 外部联系人
           $value          = ['id'=>$value['id']];
           // 发送到队列执行,上锁成功则发送到队列执行
@@ -98,7 +94,7 @@ class TagRelation extends Command
               // 状态结束
               $task['status']             = 1;
               // 最后的修改时间
-              $task['last_time']          = $lastTime - 1;
+              $task['last_time']          = time() - 1;
           }
       }
       // 修改任务情况

+ 64 - 0
app/Console/Commands/WeibanTaglist.php

@@ -0,0 +1,64 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+use App\Facades\Servers\WeiBan\OpenApi;
+use App\Facades\Servers\Logs\Log;
+
+class WeibanTaglist extends Command
+{
+  /**
+   * 任务名称
+   *
+   * @var string
+   */
+  protected $signature = 'weiban_taglist';
+
+  /**
+   * 任务描述
+   *
+   * @var string
+   */
+  protected $description = '微伴标签列表同步任务';
+
+  /**
+   * Create a new command instance.
+   *
+   * @return void
+   */
+  public function __construct()
+  {
+    parent::__construct();
+  }
+
+  /**
+   * Execute the console command.
+   *
+   * @return int
+   */
+  public function handle()
+  {
+    try {
+      // 数据结果
+      $this->sync_user();
+      // 返回结果
+      return 0;
+    } catch (\Throwable $th) {
+      // 记录错误信息
+      Log::error('weiban_taglist', $th->getMessage());
+      // 返回结果
+      return 0;
+    }
+  }
+
+
+  /**
+   * 客户关系同步
+   * 
+   * */
+  public function sync_user()
+  {
+    OpenApi::getTagList();
+  }
+}

+ 4 - 0
app/Console/Kernel.php

@@ -28,10 +28,14 @@ class Kernel extends ConsoleKernel
         $schedule->command('staff_relation')->runInBackground();
         $schedule->command('staff_remark')->runInBackground();
         $schedule->command('tag_relation')->runInBackground();
+        // 微伴标签列表同步
+        $schedule->command('weiban_taglist')->runInBackground();
         // 产品限购自动下架
         $schedule->command('product_delist')->everyMinute();
         //拼团活动
         $schedule->command('regiment')->everyMinute();
+        // 优惠券提醒
+        $schedule->command('coupon_notice')->dailyAt('15:00');
     }
 
     /**

+ 27 - 0
app/Facades/Servers/Aliyun/Sms.php

@@ -0,0 +1,27 @@
+<?php namespace App\Facades\Servers\Aliyun;
+
+use Illuminate\Support\Facades\Facade;
+
+/**
+ * 短信发送
+ * 
+ * @method static array sendSms(string $phone,string $signName,string $templateCode,array $param=[]) 发送短信
+ * 
+ * @see \App\Servers\Aliyun\Sms
+ * 
+ * 
+ */
+class Sms extends Facade
+{
+    /**
+     * Get the registered name of the component.
+     *
+     * @return string
+     */
+    protected static function getFacadeAccessor()
+    {
+        return '\App\Servers\Aliyun\Sms';
+    }
+}
+
+?>

+ 1 - 1
app/Facades/Servers/Encrypts/ApiSign.php

@@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Facade;
 /**
  * 接口签名
  * 
- * @staticmethod array encode( array $contents ,string $appid, string $appkey)  加密
+ * @method static array encode( array $contents ,string $appid, string $appkey)  加密
  * 
  * @see \App\Servers\Encrypts\ApiSign
  * 

+ 1 - 0
app/Facades/Servers/WechatMini/Mini.php

@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Facade;
  * @method static array  getUserPhone($code)        手机号授权
  * @method static string  getAccessToken()          获取AccessToken
  * @method static mixed  queryUrlLink($urlLink)     查询加密UrlLink
+ * @method static mixed  getUnlimit(string $scene, array $optional = [])                获取小程序码
  * 
  * 
  * @see \App\Servers\WechatMini\Mini

+ 2 - 1
app/Facades/Servers/WeiBan/OpenApi.php

@@ -9,7 +9,8 @@ use Illuminate\Support\Facades\Facade;
  * @method static array  getUserList(int $limit,int $offset,int $startTime=0,string $source='remark')       获取用户列表
  * @method static array  getUserDetail(string $id)                                                          获取用户详情
  * @method static array  getUserListByPhone($phone)                                                         通过手机获取用户列表
- * 
+ * @method static array  getTagList(int $limit=100,int $offset=0)                                           获取标签列表
+ * @method static array  markTags($extUserid,$addTags,$rmTags,$staffId)                                     给客户打标签
  * 
  * @see \App\Servers\WeiBan\OpenApi
  * 

+ 54 - 3
app/Http/Controllers/Admin/CouponActive.php

@@ -7,8 +7,7 @@ use App\Models\Coupon\Active as Model;
 use App\Models\Coupon\ActiveCoupon as ActiveCoupon;
 use App\Models\City;
 use App\Models\WeiBan\Tags as WeiBanTags;
-
-use function PHPUnit\Framework\isNull;
+use Intervention\Image\Facades\Image;
 
 /**
  * 优惠券领取活动
@@ -74,13 +73,65 @@ class CouponActive extends Auth{
         // 不存在数据
         if ( is_null($link) ) {
             // 从数据库获取数据
-            $link              = Mini::getUrlLink('pages/coupon/active','?id='.$id);
+            $link              = Mini::getUrlLink('pages/coupon/active','id='.$id);
             // 存起来
             cache(['admin:coupon:active:urllink:'.$id=>$link],$link ? now()->addDays(28) : now()->addMinutes(3));
         }
         // 返回结果
         return                  $link;
+	}
 
+	/**
+	 * 获取小程序海报
+	 * 
+	 */
+	public function get_poster(Model $Model){
+		// 接收参数
+		$id								= request('id',0);
+		// 查询用户
+		$oldData						= $Model->where(['id'=>$id])->first();
+		// 错误告知
+		if( !$oldData )					return $this->error('查无数据');
+		// 获取分享海报图片
+		$result 						= $this->getShareImage('id='.$id);
+		// 错误提示
+		if( isset($result['error']) )	return $this->error($result['error']);
+		// 分配数据
+		$this->assign('image',$result);
+		$this->assign('oldData',$oldData);
+		$this->assign('crumbs','海报');
+		// 加载模板
+		return 							$this->fetch();
+	}
+
+	/**
+	 * 获取分享海报图片
+	 * @param string $scene
+	 * 
+	 */
+	private function getShareImage($scene){
+		// 尝试执行
+		try {
+			// 加载图片
+			$image							= Image::make(public_path('uploads/images/poster/').'get_coupon.png');
+			// 生成小程序二维码
+			$qrcode							= Mini::getUnlimit($scene,['page'=>'pages/coupon/active','width'=>280,'is_hyaline'=>true]);
+			// 错误提示
+			if( isset($qrcode['error']) )	return $qrcode;
+			// 加载图片
+			$qrcode							= Image::make($qrcode);
+			// 插入图片
+			$image->insert($qrcode,'bottom-right',30,50);
+			// 转码成字符串
+			$image							= $image->encode('jpg', 90)->__toString();
+			// 转base64
+			$base64							= 'data:image/jpg;base64,' . base64_encode($image);
+			// 返回结果
+			return							$base64;
+		} catch (\Throwable $th) {
+			// 错误提示
+			return 							['error'=>$th->getMessage()];
+		}
 	}
 
 	/**

+ 24 - 0
app/Http/Controllers/Admin/Custom.php

@@ -180,6 +180,30 @@ class Custom extends Auth{
 		return 				json_send(['code'=>'success','msg'=>'设置成功','path'=>'']);
 	}
 
+	/**
+	 * 修改状态
+	 * 
+	 * */
+	public function set_manager(Request $request,Model $Model){
+		// 验证参数
+		$request->scene('set_manager')->validate();
+		// 设置状态
+		$uid				= request('uid',0);
+		$isManager			= request('is_manager',0);
+		// 查询用户
+		$oldData			= $Model->where(['uid'=>$uid])->first();
+		// 如果用户不存在
+		if( !$oldData )		return json_send(['code'=>'error','msg'=>'用户不存在']);
+		// 执行修改
+		$result				= $Model->edit($uid,['is_manager'=>$isManager]);		
+		// 提示新增失败
+		if( !$result )		return json_send(['code'=>'error','msg'=>'设置失败']);
+		// 记录行为
+		$this->addAdminHistory(admin('uid'),$Model->getTable(),$uid,2,$oldData,['is_manager'=>$isManager]);
+		// 告知结果
+		return 				json_send(['code'=>'success','msg'=>'设置成功','path'=>'']);
+	}
+
 	/**
 	 * 表格导入
 	 * 

+ 56 - 1
app/Http/Controllers/Admin/LotteryOrder.php

@@ -6,6 +6,8 @@ use App\Models\Lottery\Order as Model;
 use App\Models\City;
 use App\Models\Lottery\OrderReward;
 use App\Models\WeiBan\Tags as WeiBanTags;
+use Illuminate\Support\Facades\DB;
+use Intervention\Image\Facades\Image;
 
 /**
  * 优惠券自动发放规则
@@ -58,7 +60,7 @@ class LotteryOrder extends Auth{
         // 不存在数据
         if ( is_null($link) ) {
             // 从数据库获取数据
-            $link              = Mini::getUrlLink('pages/orders/lottery','?id='.$id);
+            $link              = Mini::getUrlLink('pages/orders/lottery','id='.$id);
             // 存起来
             cache(['admin:lottery:order:urllink:'.$id=>$link],$link ? now()->addDays(28) : now()->addMinutes(3));
         }
@@ -67,6 +69,59 @@ class LotteryOrder extends Auth{
 
 	}
 
+	/**
+	 * 获取小程序海报
+	 * 
+	 */
+	public function get_poster(Model $Model){
+		// 接收参数
+		$id								= request('id',0);
+		// 查询用户
+		$oldData						= $Model->where(['id'=>$id])->first();
+		// 错误告知
+		if( !$oldData )					return $this->error('查无数据');
+		// 获取分享海报图片
+		$result 						= $this->getShareImage('id='.$id);
+		// 错误提示
+		if( isset($result['error']) )	return $this->error($result['error']);
+		// 分配数据
+		$this->assign('image',$result);
+		$this->assign('oldData',$oldData);
+		$this->assign('crumbs','海报');
+		// 加载模板
+		return 							$this->fetch();
+	}
+
+	/**
+	 * 获取分享海报图片
+	 * @param  int $scene  场景值
+	 * 
+	 */
+	private function getShareImage($scene){
+		// 尝试执行
+		try {
+			// 加载图片
+			$image							= Image::make(public_path('uploads/images/poster/').'score_reward.png');
+			// 生成小程序二维码
+			$qrcode							= Mini::getUnlimit($scene,['page'=>'pages/orders/lottery','width'=>280,'is_hyaline'=>true]);
+			// 错误提示
+			if( isset($qrcode['error']) )	return $qrcode;
+			// 加载图片
+			$qrcode							= Image::make($qrcode)->resize(200,200);
+			// 插入图片
+			$image->insert($qrcode,'bottom-left',60,60);
+			// 转码成字符串
+			$image							= $image->encode('jpg', 90)->__toString();
+			// 转base64
+			$base64							= 'data:image/jpg;base64,' . base64_encode($image);
+			// 返回结果
+			return							$base64;
+		} catch (\Throwable $th) {
+			// 错误提示
+			return 							['error'=>$th->getMessage()];
+		}
+	}
+
 	/**
 	 * 添加
 	 * 

+ 582 - 576
app/Http/Controllers/Admin/Orders.php

@@ -20,6 +20,7 @@ use PhpOffice\PhpSpreadsheet\Style\Alignment;
 use PhpOffice\PhpSpreadsheet\Style\Fill;
 use Intervention\Image\Facades\Image;
 use Intervention\Image\Gd\Font;
+use App\Models\Custom\Shoptype;
 
 /**
  * 订单管理
@@ -28,53 +29,53 @@ use Intervention\Image\Gd\Font;
  *
  */
 class Orders extends Auth{
+	
+	protected function _initialize(){
+		parent::_initialize();
+		$this->assign('breadcrumb1','销售管理');
+		$this->assign('breadcrumb2','订单管理');
+	}
 
-    protected function _initialize(){
-        parent::_initialize();
-        $this->assign('breadcrumb1','销售管理');
-        $this->assign('breadcrumb2','订单管理');
-    }
-
-    /**
-     * 首页列表
-     *
-     * */
-    public function index(Model $Model,OrdersProduct $OrdersProduct,Product $Product,Custom $Custom,Business $Business){
-        // 接受参数
-        $code					= request('order_code','');
-        $orders_other			= request('orders_other',0);
-        $productCode			= request('product_code','');
-        $phone					= request('phone','');
-        $customCode				= request('custom_code','');
-        $productName			= request('product_name','');
-        $province				= request('contact_province','');
-        $city					= request('contact_city','');
-        $area					= request('contact_area','');
-        $status					= request('status',0);
-        $startTime				= request('start_time','');
-        $endTime				= request('end_time','');
-        $is_regiment			= request('is_regiment','');
+	/**
+	 * 首页列表
+	 * 
+	 * */
+    public function index(Model $Model,OrdersProduct $OrdersProduct,Product $Product,Custom $Custom,Shoptype $Shoptype,Business $Business){
+		// 接受参数
+		$code					= request('order_code','');
+		$orders_other			= request('orders_other',0);
+		$productCode			= request('product_code','');
+		$phone					= request('phone','');
+		$customCode				= request('custom_code','');
+		$productName			= request('product_name','');
+		$province				= request('contact_province','');
+		$city					= request('contact_city','');
+		$area					= request('contact_area','');
+		$status					= request('status',0);
+		$startTime				= request('start_time','');
+		$endTime				= request('end_time','');
+		$is_regiment			= request('is_regiment','');
         $businessId				= request('business_id','');
-        // 编码转ID
-        $id						= $code ? $Model->codeToId($code) : 0;
-        $productId				= $productCode ? $Product->codeToId($productCode) : 0;
-        $uid					= $customCode ? $Custom->codeToId($customCode) : 0;
-        // 查询条件
-        $map 					= [];
-        // 编码ID
-        if( $id )				$map[] = ['orders_product.order_id','=',$id];
-        // 编码ID
-        if( $orders_other )		$map[] = $orders_other == 1 ? ['orders_product.product_id','>',0] : ['orders_product.product_id','=',0];
-        if( $uid )				$map[] = ['custom.uid','=',$uid];
-        if( $productId )		$map[] = ['orders_product.product_id','=',$productId];
-        if( $productName )		$map[] = ['orders_product.product_name','LIKE','%'.$productName.'%'];
-        if( $phone )			$map[] = ['orders_addr.contact_phone','=',$phone];
-        if( $province )			$map[] = ['orders_addr.contact_province','LIKE','%'.$province.'%'];
-        if( $city )				$map[] = ['orders_addr.contact_city','LIKE','%'.$city.'%'];
-        if( $area )				$map[] = ['orders_addr.contact_area','LIKE','%'.$area.'%'];
-        if( $startTime )		$map[] = ['orders_product.insert_time','>=',strtotime($startTime)];
-        if( $endTime )			$map[] = ['orders_product.insert_time','<=',strtotime($endTime)];
-        if( $status )			$map[] = ['orders_product.status','=',$status];
+		// 编码转ID
+		$id						= $code ? $Model->codeToId($code) : 0;
+		$productId				= $productCode ? $Product->codeToId($productCode) : 0;
+		$uid					= $customCode ? $Custom->codeToId($customCode) : 0;
+		// 查询条件
+		$map 					= [];
+		// 编码ID
+		if( $id )				$map[] = ['orders_product.order_id','=',$id];
+		// 编码ID
+		if( $orders_other )		$map[] = $orders_other == 1 ? ['orders_product.product_id','>',0] : ['orders_product.product_id','=',0];
+		if( $uid )				$map[] = ['custom.uid','=',$uid];
+		if( $productId )		$map[] = ['orders_product.product_id','=',$productId];
+		if( $productName )		$map[] = ['orders_product.product_name','LIKE','%'.$productName.'%'];
+		if( $phone )			$map[] = ['orders_addr.contact_phone','=',$phone];
+		if( $province )			$map[] = ['orders_addr.contact_province','LIKE','%'.$province.'%'];
+		if( $city )				$map[] = ['orders_addr.contact_city','LIKE','%'.$city.'%'];
+		if( $area )				$map[] = ['orders_addr.contact_area','LIKE','%'.$area.'%'];
+		if( $startTime )		$map[] = ['orders_product.insert_time','>=',strtotime($startTime)];
+		if( $endTime )			$map[] = ['orders_product.insert_time','<=',strtotime($endTime)];
+		if( $status )			$map[] = ['orders_product.status','=',$status];
         if( $businessId )		$map[] = ['orders_product.business_id','=',$id];
         if($is_regiment){
             if( $is_regiment == 1)		$map[] = ['orders.regiment_id','>',0];
@@ -90,329 +91,330 @@ class Orders extends Auth{
                 $shopIds       = $Business::query()->where('leader_uid',$session['admin_uid'])->pluck('id')->toArray();
             }
         }
-        // 查询数据
-        $list					= $OrdersProduct->query()
-            ->join('custom','orders_product.custom_uid','=','custom.uid')
-            ->join('orders_addr','orders_addr.order_id','=','orders_product.order_id')
-            ->leftJoin('orders','orders.id','=','orders_product.order_id');
+		// 查询数据
+		$list					= $OrdersProduct->query()
+									->join('custom','orders_product.custom_uid','=','custom.uid')
+									->join('orders_addr','orders_addr.order_id','=','orders_product.order_id')
+									->leftJoin('orders','orders.id','=','orders_product.order_id');
         if (isset($shopIds))    $list   =   $list->whereIn('orders_product.business_id',$shopIds);
         $list                   = $list->where($map)
-            ->orderByDesc('id')
-            ->select([
-                'orders_product.*','custom.username as custom_name','orders.regiment_id as regiment_id',
-                'orders_addr.contact_name','orders_addr.contact_shop','orders_addr.contact_phone','orders_addr.contact_province','orders_addr.contact_city','orders_addr.contact_area','orders_addr.contact_addr'
-            ])
-            ->paginate(request('limit',config('page_num',10)))->appends(request()->all());
-        // 循环处理数据
-        foreach ($list as $key => $value) {
-            // id转编号
-            $value['order_code']	= $Model->idToCode($value['order_id']);
-            $value['custom_code']	= $Custom->idToCode($value['custom_uid']);
-            $value['state']			= $Model->getState($value['status'],'state');
+									->orderByDesc('id')
+									->select([
+										'orders_product.*','custom.username as custom_name','orders.regiment_id as regiment_id',
+										'orders_addr.contact_name','orders_addr.contact_shop','orders_addr.shop_type','orders_addr.contact_phone','orders_addr.contact_province','orders_addr.contact_city','orders_addr.contact_area','orders_addr.contact_addr'
+									])
+									->paginate(request('limit',config('page_num',10)))->appends(request()->all());
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+			// id转编号
+			$value['order_code']	= $Model->idToCode($value['order_id']);
+			$value['custom_code']	= $Custom->idToCode($value['custom_uid']);
+			$value['state']			= $Model->getState($value['status'],'state');
+			$value['shop_type']		= $Shoptype->getOne($value['shop_type'],'name');
             $value['business_name']= Business::query()->where('id',$value['business_id'])->value('name');
-            $value['product_code']	= $value['product_id'] ? $Product->idToCode($value['product_id']) : '— —';
-            // 重组
-            $list[$key]				= $value;
-        }
+			$value['product_code']	= $value['product_id'] ? $Product->idToCode($value['product_id']) : '— —';
+			// 重组
+			$list[$key]				= $value;
+		}
         $businessList 			    = $Business->getList();
-        // 分配数据
-        $this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
-        $this->assign('list', $list);
+		// 分配数据
+		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
+		$this->assign('list', $list);
         $this->assign('businessList',$businessList);
-        // 加载模板
-        return						$this->fetch();
+		// 加载模板
+		return						$this->fetch();
     }
 
 
-    /**
-     * 首页列表
-     *
-     * */
+	/**
+	 * 首页列表
+	 * 
+	 * */
     public function detail(Model $Model,AdminUser $AdminUser,OrdersProduct $OrdersProduct,Product $Product,Custom $Custom,OrdersAddr $OrdersAddr,Receipt $Receipt){
-        // 接受参数
-        $id						= request('order_id','');
-        // 查询数据
-        $order					= $Model->query()->find($id);
-        // 查询不到订单
-        if( !$order	)			return $this->error('订单数据不存在');
-        // id转编号
-        $order['order_code']	= $Model->idToCode($order['id']);
-        $order['custom_code']	= $Custom->idToCode($order['custom_uid']);
-        $order['custom_name']	= $Custom->getValue($order['custom_uid'],'username');
-        $order['state']			= $Model->getState($order['status'],'state');
-        // 查询子订单数据
-        $orderItems				= $OrdersProduct->query()->where([['order_id','=',$id]])->select(['id as item_id','order_id','product_id','buy_num','pay_total','is_rebate','sku_attr_names as product_spec','product_name','product_thumb'])->get()->toArray();
-        // 地址
-        $orderAddr				= $OrdersAddr->query()->where([['order_id','=',$id]])->first(['contact_name','contact_phone','contact_province','contact_city','contact_area','contact_addr','contact_shop']);
-        // 审核记录
-        $orderReceipt			= $Receipt->query()->where([['order_id','=',$id]])->orderByDesc('id')->get()->toArray();
-        // 循环数据
-        foreach ($orderItems as $key => $value) {
-            $value['product_code']	= $Product->idToCode($value['product_id']);
-            $orderItems[$key]  = $value;
-        }
-        // 循环数据
-        foreach ($orderReceipt as $key => $value) {
-            // 操作人员
-            $value['admin_name']= $AdminUser->getOne($value['admin_uid'],'username');
-            $value['image']		= path_compat($value['image']);
-            $orderReceipt[$key] = $value;
-        }
-        // 积分
-        $score					= $orderReceipt ? max(array_column($orderReceipt,'give_score')) : 0;
-        // 恭喜
-        $shopName				= $orderAddr['contact_shop'] ? $orderAddr['contact_shop'] : $order['custom_name'];
-        // 结果
-        $shareImage				= $this->getShareImage($shopName,$score);
-        // 分配数据
-        $this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
-        $this->assign('order', $order);
-        $this->assign('orderAddr', $orderAddr);
-        $this->assign('orderItems', $orderItems);
-        $this->assign('orderReceipt', $orderReceipt);
-        $this->assign('shareImage', $shareImage);
-        // 加载模板
-        return						$this->fetch();
+		// 接受参数
+		$id						= request('order_id','');
+		// 查询数据
+		$order					= $Model->query()->find($id);
+		// 查询不到订单
+		if( !$order	)			return $this->error('订单数据不存在');
+		// id转编号
+		$order['order_code']	= $Model->idToCode($order['id']);
+		$order['custom_code']	= $Custom->idToCode($order['custom_uid']);
+		$order['custom_name']	= $Custom->getValue($order['custom_uid'],'username');
+		$order['state']			= $Model->getState($order['status'],'state');
+		// 查询子订单数据
+		$orderItems				= $OrdersProduct->query()->where([['order_id','=',$id]])->select(['id as item_id','order_id','product_id','buy_num','pay_total','is_rebate','sku_attr_names as product_spec','product_name','product_thumb'])->get()->toArray();
+		// 地址
+		$orderAddr				= $OrdersAddr->query()->where([['order_id','=',$id]])->first(['contact_name','contact_phone','contact_province','contact_city','contact_area','contact_addr','contact_shop']);
+		// 审核记录
+		$orderReceipt			= $Receipt->query()->where([['order_id','=',$id]])->orderByDesc('id')->get()->toArray();
+		// 循环数据
+		foreach ($orderItems as $key => $value) {
+			$value['product_code']	= $Product->idToCode($value['product_id']);
+			$orderItems[$key]  = $value;
+		}
+		// 循环数据
+		foreach ($orderReceipt as $key => $value) {
+			// 操作人员
+			$value['admin_name']= $AdminUser->getOne($value['admin_uid'],'username');
+			$value['image']		= path_compat($value['image']);
+			$orderReceipt[$key] = $value;
+		}
+		// 积分
+		$score					= $orderReceipt ? max(array_column($orderReceipt,'give_score')) : 0;
+		// 恭喜
+		$shopName				= $orderAddr['contact_shop'] ? $orderAddr['contact_shop'] : $order['custom_name'];
+		// 结果
+		$shareImage				= $this->getShareImage($shopName,$score);
+		// 分配数据
+		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
+		$this->assign('order', $order);
+		$this->assign('orderAddr', $orderAddr);
+		$this->assign('orderItems', $orderItems);
+		$this->assign('orderReceipt', $orderReceipt);
+		$this->assign('shareImage', $shareImage);
+		// 加载模板
+		return						$this->fetch();
     }
 
 
-    /**
-     * 状态
-     *
-     * */
-    public function set_status( Request $request, Model $Model,OrdersProduct $OrdersProduct,CustomScore $CustomScore){
-        // 验证参数
-        $request->scene('set_status')->validate();
-        // 接收参数
-        $id				= request('id',0);
-        $status			= request('status',0);
-        // 获取产品和数量
-        $oldData 		= $Model->query()->find($id,['id','order_score','custom_uid','insert_time']);
-        // 如果用户不存在
-        if( !$oldData )	return json_send(['code'=>'error','msg'=>'订单不存在']);
-        // 组合数据,写入订单表,子表
-        DB::beginTransaction();
-        try{
-            // 查询数据
-            $result			= $Model->setOrderStatus($id,$status,$OrdersProduct);
-            // 提示新增失败
-            if( isset($result['error']) )	{
-                // 回退数据
-                DB::rollBack();
-                // 提示信息
-                return		json_send(['code'=>'error','msg'=>$result['error'],'data'=>['error'=>$result['error']]]);
-            }
-            if( $status == 4 ){
-                // 取消积分
-                if( $oldData['order_score'] > 0 ) {
-                    // 如果扣减失败
-                    $result 	= $CustomScore->trade($oldData['custom_uid'],$oldData['id'],($oldData['order_score']*-1),6,1);
-                    // 提示新增失败
-                    if( isset($result['error']) )	{
-                        // 回退数据
-                        DB::rollBack();
-                        // 提示信息
-                        return json_send(['code'=>'error','msg'=>'取消赠送积分失败','data'=>['error'=>$result['error']]]);
-                    }
-                }
-                // 取消关联订单
-                $result			= $Model->cancelRelate($oldData['insert_time'],$oldData['custom_uid'],$OrdersProduct,$CustomScore);
-                // 提示新增失败
-                if( isset($result['error']) )	{
-                    // 回退数据
-                    DB::rollBack();
-                    // 提示信息
-                    return		json_send(['code'=>'error','msg'=>'取消关联订单失败','data'=>['error'=>$result['error']]]);
-                }
-            }
-            // 提交数据
-            DB::commit();
-            // 告知结果
-            return			json_send(['code'=>'success','msg'=>'设置成功','path'=>'']);
-            // 返回结果
-        } catch (\Throwable $th) {
-            // 回退数据
-            DB::rollBack();
-            // 下单失败提示
-            return			json_send(['code'=>'error','msg'=>'设置失败','data'=>['error'=>$th->getMessage().$th->getLine()]]);
-        }
-    }
-
+	/**
+	 * 状态
+	 * 
+	 * */
+	public function set_status( Request $request, Model $Model,OrdersProduct $OrdersProduct,CustomScore $CustomScore){
+		// 验证参数
+		$request->scene('set_status')->validate();
+		// 接收参数
+		$id				= request('id',0);
+		$status			= request('status',0);
+		// 获取产品和数量
+		$oldData 		= $Model->query()->find($id,['id','order_score','custom_uid','insert_time']);
+		// 如果用户不存在
+		if( !$oldData )	return json_send(['code'=>'error','msg'=>'订单不存在']);
+		// 组合数据,写入订单表,子表
+		DB::beginTransaction();
+		try{
+			// 查询数据
+			$result			= $Model->setOrderStatus($id,$status,$OrdersProduct);
+			// 提示新增失败
+			if( isset($result['error']) )	{
+				// 回退数据
+				DB::rollBack();
+				// 提示信息
+				return		json_send(['code'=>'error','msg'=>$result['error'],'data'=>['error'=>$result['error']]]);
+			}
+			if( $status == 4 ){
+				// 取消积分
+				if( $oldData['order_score'] > 0 ) {
+					// 如果扣减失败
+					$result 	= $CustomScore->trade($oldData['custom_uid'],$oldData['id'],($oldData['order_score']*-1),6,1);
+					// 提示新增失败
+					if( isset($result['error']) )	{
+						// 回退数据
+						DB::rollBack();
+						// 提示信息
+						return json_send(['code'=>'error','msg'=>'取消赠送积分失败','data'=>['error'=>$result['error']]]);
+					}
+				}
+				// 取消关联订单
+				$result			= $Model->cancelRelate($oldData['insert_time'],$oldData['custom_uid'],$OrdersProduct,$CustomScore);
+				// 提示新增失败
+				if( isset($result['error']) )	{
+					// 回退数据
+					DB::rollBack();
+					// 提示信息
+					return		json_send(['code'=>'error','msg'=>'取消关联订单失败','data'=>['error'=>$result['error']]]);
+				}
+			}
+			// 提交数据
+			DB::commit();
+			// 告知结果
+			return			json_send(['code'=>'success','msg'=>'设置成功','path'=>'']);
+			// 返回结果
+		} catch (\Throwable $th) {
+			// 回退数据
+			DB::rollBack();
+			// 下单失败提示
+			return			json_send(['code'=>'error','msg'=>'设置失败','data'=>['error'=>$th->getMessage().$th->getLine()]]);
+		}
+	}
+	
 
-    /**
-     * 表格导入
-     *
-     * */
-    public function import_execl( Request $request,Model $Model,Custom $Custom,OrdersAddr $OrdersAddr,OrdersProduct $OrdersProduct, FilesManager $FilesManager,CustomAddr $CustomAddr){
-        // 验证参数
-        $request->scene('import_execl')->validate();
-        // 获取表格信息
-        $file								= request()->file('order_file');
-        // 返回结果
-        $sheetList							= $FilesManager->excelToOrder($file);
-        // 如果不存在结果
-        if( isset($sheetList['error']) )	return json_send(['code'=>'error','msg'=>$sheetList['error']]);
-        // 订单列表
-        $orderList							= [];
-        // 当前时间
-        $time								= time();
-        // 循环表格数据
-        foreach ($sheetList as $value) 		{
-            // 状态更改
-            $value['status']				= $Model->getWeibanStatus($value['status']);
-            // 客户手机号
-            $orderList[$value['weizan_orderid']]['custom']				= ['phone'=>$value['contact_phone'],'username'=>$value['buyer_nick']];
-            // 组合成订单的收件地址
-            $orderList[$value['weizan_orderid']]['contact']				= [
-                'contact_name'=>trim($value['contact_name']),
-                'contact_phone'=>trim($value['contact_phone']),
-                'contact_province'=>trim($value['contact_province']),
-                'contact_city'=>trim($value['contact_city']),
-                'contact_area'=>trim($value['contact_area']),
-                'contact_addr'=>trim($value['contact_addr'])
-            ];
+	/**
+	 * 表格导入
+	 * 
+	 * */
+	public function import_execl( Request $request,Model $Model,Custom $Custom,OrdersAddr $OrdersAddr,OrdersProduct $OrdersProduct, FilesManager $FilesManager,CustomAddr $CustomAddr){
+		// 验证参数
+		$request->scene('import_execl')->validate();
+		// 获取表格信息
+		$file								= request()->file('order_file');
+		// 返回结果
+		$sheetList							= $FilesManager->excelToOrder($file);
+		// 如果不存在结果
+		if( isset($sheetList['error']) )	return json_send(['code'=>'error','msg'=>$sheetList['error']]);
+		// 订单列表
+		$orderList							= [];
+		// 当前时间
+		$time								= time();
+		// 循环表格数据
+		foreach ($sheetList as $value) 		{
+			// 状态更改
+			$value['status']				= $Model->getWeibanStatus($value['status']);
+			// 客户手机号
+			$orderList[$value['weizan_orderid']]['custom']				= ['phone'=>$value['contact_phone'],'username'=>$value['buyer_nick']];
+			// 组合成订单的收件地址
+			$orderList[$value['weizan_orderid']]['contact']				= [
+																			'contact_name'=>trim($value['contact_name']),
+																			'contact_phone'=>trim($value['contact_phone']),
+																			'contact_province'=>trim($value['contact_province']),
+																			'contact_city'=>trim($value['contact_city']),
+																			'contact_area'=>trim($value['contact_area']),
+																			'contact_addr'=>trim($value['contact_addr'])
+																		];
+			
+			// 组合成订单的收件地址
+			$orderList[$value['weizan_orderid']]['product'][]			= [
+																			'status'=>$value['status'],
+																			'product_name'=>$value['product_name'],
+																			'sku_attr_names'=>$value['sku_attr_names'],
+																			'buy_num'=>$value['buy_num'],
+																			'pay_total'=>$value['pay_total'],
+																			'price_total'=>$value['pay_total'],
+																			'insert_time'=>$value['insert_time'],
+																			'update_time'=>$time,
+																		];
+			// 组合成订单的需要的数据
+			if( !isset($orderList[$value['weizan_orderid']]['order']) )	$orderList[$value['weizan_orderid']]['order'] = ['weizan_orderid'=>$value['weizan_orderid'],'status'=>$value['status'],'pay_total'=>0,'price_total'=>0,'insert_time'=>$value['insert_time']];
+			// 价格
+			$orderList[$value['weizan_orderid']]['order']['pay_total']  = $orderList[$value['weizan_orderid']]['order']['pay_total'] + $value['pay_total'];
+			$orderList[$value['weizan_orderid']]['order']['price_total']  = $orderList[$value['weizan_orderid']]['order']['pay_total'];
+		}
+		// 新增地址
+		$newAddrList						= [];
+		// 要更新的订单子表
+		$orderProduct						= [];
+		// 循环订单列表
+		foreach ($orderList as $value) 		{
+			// 获取手机号,查询是否用客户
+			$custom							= $Custom->getOneByPhone($value['custom']['phone']);
+			// 如果存在手机号
+			$uid							= $custom ? $custom['uid'] : $Custom->add($value['custom']);
+			// 如果客户存在
+			if( !$uid )						return json_send(['code'=>'error','msg'=>$value['custom']['username'].'【'.$value['custom']['phone'].'】'.'无法创建用户']);
+			// 通过订单号查询是否存在系统订单
+			$orderId						= $Model->query()->where([['weizan_orderid','=',$value['order']['weizan_orderid']]])->value('id');
+			// 客户ID
+			$value['order']['custom_uid'] 	= $uid;
+			// 存在订单获取订单ID,不存在则新增
+			$orderId						= $orderId ? $Model->edit($orderId,$value['order']) : $Model->add($value['order']);
+			// 如果客户存在
+			if( !$orderId )					return json_send(['code'=>'error','msg'=>$orderId.'订单写入失败']);
+			// 联系地址
+			$contact						= $value['contact'];
+			// 存在详细地址,才创建地址库
+			if( $contact['contact_name'] && $contact['contact_phone'] && $contact['contact_province'] && $contact['contact_city'] && $contact['contact_area'] && $contact['contact_addr'] )	{
+				// 收件地址是否存在
+				$oldAddr					= $CustomAddr->query()->where([['custom_uid','=',$uid]])->first();
+				// 如果不存在地址
+				if( !$oldAddr )				$CustomAddr->add(['custom_uid'=>$uid,'contact_name'=>$contact['contact_name'],'contact_phone'=>$contact['contact_phone'],'contact_province'=>$contact['contact_province'],'contact_city'=>$contact['contact_city'],'contact_area'=>$contact['contact_area'],'contact_addr'=>$contact['contact_addr']]);
+			}
+			// 订单地址库
+			$addrId							= $OrdersAddr->query()->where([['order_id','=',$orderId]])->value('id');
+			// 订单ID
+			$value['contact']['order_id']	= $orderId;
+			// 订单地址ID
+			$value['contact']['id'] 		= (int)$addrId;
+			// 不存在地址的话
+			$newAddrList[] 					= $value['contact'];
+			// 循环子订单
+			foreach ( $value['product'] as 	$product ) {
+				// 数据结果
+				$product['order_id']		= $orderId;
+				$product['custom_uid']		= $uid;
+				$product['id']				= (int) $OrdersProduct->query()->where([['order_id','=',$orderId],'product_name'=>$product['product_name'],'sku_attr_names'=>$product['sku_attr_names']])->value('id');
+				$orderProduct[]				= $product;
+			}
+		}
+		// 新地址写入
+		$OrdersProduct->query()->upsert($orderProduct,'id',['product_name','sku_attr_names','buy_num','pay_total','price_total','update_time']);
+		// 新地址写入
+		$OrdersAddr->query()->upsert($newAddrList,'id',['contact_name','contact_phone','contact_province','contact_city','contact_area','contact_addr']);
+		// 提示成功
+		return								json_send(['code'=>'success','msg'=>'订单导入成功','path'=>'']);
+	}
 
-            // 组合成订单的收件地址
-            $orderList[$value['weizan_orderid']]['product'][]			= [
-                'status'=>$value['status'],
-                'product_name'=>$value['product_name'],
-                'sku_attr_names'=>$value['sku_attr_names'],
-                'buy_num'=>$value['buy_num'],
-                'pay_total'=>$value['pay_total'],
-                'price_total'=>$value['pay_total'],
-                'insert_time'=>$value['insert_time'],
-                'update_time'=>$time,
-            ];
-            // 组合成订单的需要的数据
-            if( !isset($orderList[$value['weizan_orderid']]['order']) )	$orderList[$value['weizan_orderid']]['order'] = ['weizan_orderid'=>$value['weizan_orderid'],'status'=>$value['status'],'pay_total'=>0,'price_total'=>0,'insert_time'=>$value['insert_time']];
-            // 价格
-            $orderList[$value['weizan_orderid']]['order']['pay_total']  = $orderList[$value['weizan_orderid']]['order']['pay_total'] + $value['pay_total'];
-            $orderList[$value['weizan_orderid']]['order']['price_total']  = $orderList[$value['weizan_orderid']]['order']['pay_total'];
-        }
-        // 新增地址
-        $newAddrList						= [];
-        // 要更新的订单子表
-        $orderProduct						= [];
-        // 循环订单列表
-        foreach ($orderList as $value) 		{
-            // 获取手机号,查询是否用客户
-            $custom							= $Custom->getOneByPhone($value['custom']['phone']);
-            // 如果存在手机号
-            $uid							= $custom ? $custom['uid'] : $Custom->add($value['custom']);
-            // 如果客户存在
-            if( !$uid )						return json_send(['code'=>'error','msg'=>$value['custom']['username'].'【'.$value['custom']['phone'].'】'.'无法创建用户']);
-            // 通过订单号查询是否存在系统订单
-            $orderId						= $Model->query()->where([['weizan_orderid','=',$value['order']['weizan_orderid']]])->value('id');
-            // 客户ID
-            $value['order']['custom_uid'] 	= $uid;
-            // 存在订单获取订单ID,不存在则新增
-            $orderId						= $orderId ? $Model->edit($orderId,$value['order']) : $Model->add($value['order']);
-            // 如果客户存在
-            if( !$orderId )					return json_send(['code'=>'error','msg'=>$orderId.'订单写入失败']);
-            // 联系地址
-            $contact						= $value['contact'];
-            // 存在详细地址,才创建地址库
-            if( $contact['contact_name'] && $contact['contact_phone'] && $contact['contact_province'] && $contact['contact_city'] && $contact['contact_area'] && $contact['contact_addr'] )	{
-                // 收件地址是否存在
-                $oldAddr					= $CustomAddr->query()->where([['custom_uid','=',$uid]])->first();
-                // 如果不存在地址
-                if( !$oldAddr )				$CustomAddr->add(['custom_uid'=>$uid,'contact_name'=>$contact['contact_name'],'contact_phone'=>$contact['contact_phone'],'contact_province'=>$contact['contact_province'],'contact_city'=>$contact['contact_city'],'contact_area'=>$contact['contact_area'],'contact_addr'=>$contact['contact_addr']]);
-            }
-            // 订单地址库
-            $addrId							= $OrdersAddr->query()->where([['order_id','=',$orderId]])->value('id');
-            // 订单ID
-            $value['contact']['order_id']	= $orderId;
-            // 订单地址ID
-            $value['contact']['id'] 		= (int)$addrId;
-            // 不存在地址的话
-            $newAddrList[] 					= $value['contact'];
-            // 循环子订单
-            foreach ( $value['product'] as 	$product ) {
-                // 数据结果
-                $product['order_id']		= $orderId;
-                $product['custom_uid']		= $uid;
-                $product['id']				= (int) $OrdersProduct->query()->where([['order_id','=',$orderId],'product_name'=>$product['product_name'],'sku_attr_names'=>$product['sku_attr_names']])->value('id');
-                $orderProduct[]				= $product;
-            }
-        }
-        // 新地址写入
-        $OrdersProduct->query()->upsert($orderProduct,'id',['product_name','sku_attr_names','buy_num','pay_total','price_total','update_time']);
-        // 新地址写入
-        $OrdersAddr->query()->upsert($newAddrList,'id',['contact_name','contact_phone','contact_province','contact_city','contact_area','contact_addr']);
-        // 提示成功
-        return								json_send(['code'=>'success','msg'=>'订单导入成功','path'=>'']);
-    }
+	/**
+	 * 批量修改状态
+	 * 
+	 * */
+	public function import_execl_status( Request $request,Model $Model,OrdersProduct $OrdersProduct,FilesManager $FilesManager){
+		// 验证参数
+		$request->scene('import_execl_status')->validate();
+		// 获取表格信息
+		$file								= request()->file('order_file');
+		// 返回结果
+		$sheetList							= $FilesManager->excelToOrderStatus($file);
+		// 如果不存在结果
+		if( isset($sheetList['error']) )	return json_send(['code'=>'error','msg'=>$sheetList['error']]);
+		// 循环表格数据
+		foreach ($sheetList as $key=>$value) 		{
+			// 客户ID
+			$orderId						= $Model->codeToId($value['order_code']);
+			// 如果客户ID有误
+			if( !$orderId )					return json_send(['code'=>'error','msg'=>$value['order_code'].'编码有误']);
+			// 订单状态
+			$status							= $Model->getWeibanStatus($value['status']);
+			// 状态提示
+			if( $status < 0 )				return json_send(['code'=>'error','msg'=>$value['order_code'].'状态有误']);
+			// 修改数据
+			$result							= $Model->setOrderStatus($orderId,$status,$OrdersProduct);
+			// 提示
+			if( isset($result['error'])	)	return json_send(['code'=>'error','msg'=>$value['order_code'].$result['error']]);
+		}
+		// 提示成功
+		return								json_send(['code'=>'success','msg'=>'订单导入成功','path'=>'']);
+	}
 
-    /**
-     * 批量修改状态
-     *
-     * */
-    public function import_execl_status( Request $request,Model $Model,OrdersProduct $OrdersProduct,FilesManager $FilesManager){
-        // 验证参数
-        $request->scene('import_execl_status')->validate();
-        // 获取表格信息
-        $file								= request()->file('order_file');
-        // 返回结果
-        $sheetList							= $FilesManager->excelToOrderStatus($file);
-        // 如果不存在结果
-        if( isset($sheetList['error']) )	return json_send(['code'=>'error','msg'=>$sheetList['error']]);
-        // 循环表格数据
-        foreach ($sheetList as $key=>$value) 		{
-            // 客户ID
-            $orderId						= $Model->codeToId($value['order_code']);
-            // 如果客户ID有误
-            if( !$orderId )					return json_send(['code'=>'error','msg'=>$value['order_code'].'编码有误']);
-            // 订单状态
-            $status							= $Model->getWeibanStatus($value['status']);
-            // 状态提示
-            if( $status < 0 )				return json_send(['code'=>'error','msg'=>$value['order_code'].'状态有误']);
-            // 修改数据
-            $result							= $Model->setOrderStatus($orderId,$status,$OrdersProduct);
-            // 提示
-            if( isset($result['error'])	)	return json_send(['code'=>'error','msg'=>$value['order_code'].$result['error']]);
-        }
-        // 提示成功
-        return								json_send(['code'=>'success','msg'=>'订单导入成功','path'=>'']);
-    }
-
-    /**
-     * 导出表格导入
-     *
-     * */
-    public function down_excel(Model $Model,OrdersProduct $OrdersProduct,Product $Product,Custom $Custom,Business $Business){
-        // 接受参数
-        $code					= request('order_code','');
-        $productCode			= request('product_code','');
-        $orders_other			= request('orders_other',0);
-        $customCode				= request('custom_code','');
-        $productName			= request('product_name','');
-        $phone					= request('phone','');
-        $province				= request('contact_province','');
-        $city					= request('contact_city','');
-        $area					= request('contact_area','');
-        $status					= request('status',0);
-        $startTime				= request('start_time','');
-        $endTime				= request('end_time','');
-        // 编码转ID
-        $id						= $code ? $Model->codeToId($code) : 0;
-        $productId				= $productCode ? $Product->codeToId($productCode) : 0;
-        $uid					= $customCode ? $Custom->codeToId($customCode) : 0;
-        // 查询条件
-        $map 					= [];
-        // 编码ID
-        if( $id )				$map[] = ['orders_product.order_id','=',$id];
-        if( $uid )				$map[] = ['custom.uid','=',$uid];
-        // 编码ID
-        if( $orders_other )		$map[] = $orders_other == 1 ? ['orders_product.product_id','>',0] : ['orders_product.product_id','=',0];
-        if( $productId )		$map[] = ['orders_product.product_id','=',$productId];
-        if( $productName )		$map[] = ['orders_product.product_name','=',$productName];
-        if( $phone )			$map[] = ['orders_addr.contact_phone','=',$phone];
-        if( $province )			$map[] = ['orders_addr.contact_province','LIKE','%'.$province.'%'];
-        if( $city )				$map[] = ['orders_addr.contact_city','LIKE','%'.$city.'%'];
-        if( $area )				$map[] = ['orders_addr.contact_area','LIKE','%'.$area.'%'];
-        if( $startTime )		$map[] = ['orders_product.insert_time','>=',strtotime($startTime)];
-        if( $endTime )			$map[] = ['orders_product.insert_time','<=',strtotime($endTime)];
-        if( $status )			$map[] = ['orders_product.status','=',$status];
+	/**
+	 * 导出表格导入
+	 * 
+	 * */
+	public function down_excel(Model $Model,OrdersProduct $OrdersProduct,Product $Product,Custom $Custom,Shoptype $Shoptype,Business $Business){
+		// 接受参数
+		$code					= request('order_code','');
+		$productCode			= request('product_code','');
+		$orders_other			= request('orders_other',0);
+		$customCode				= request('custom_code','');
+		$productName			= request('product_name','');
+		$phone					= request('phone','');
+		$province				= request('contact_province','');
+		$city					= request('contact_city','');
+		$area					= request('contact_area','');
+		$status					= request('status',0);
+		$startTime				= request('start_time','');
+		$endTime				= request('end_time','');
+		// 编码转ID
+		$id						= $code ? $Model->codeToId($code) : 0;
+		$productId				= $productCode ? $Product->codeToId($productCode) : 0;
+		$uid					= $customCode ? $Custom->codeToId($customCode) : 0;
+		// 查询条件
+		$map 					= [];
+		// 编码ID
+		if( $id )				$map[] = ['orders_product.order_id','=',$id];
+		if( $uid )				$map[] = ['custom.uid','=',$uid];
+		// 编码ID
+		if( $orders_other )		$map[] = $orders_other == 1 ? ['orders_product.product_id','>',0] : ['orders_product.product_id','=',0];
+		if( $productId )		$map[] = ['orders_product.product_id','=',$productId];
+		if( $productName )		$map[] = ['orders_product.product_name','=',$productName];
+		if( $phone )			$map[] = ['orders_addr.contact_phone','=',$phone];
+		if( $province )			$map[] = ['orders_addr.contact_province','LIKE','%'.$province.'%'];
+		if( $city )				$map[] = ['orders_addr.contact_city','LIKE','%'.$city.'%'];
+		if( $area )				$map[] = ['orders_addr.contact_area','LIKE','%'.$area.'%'];
+		if( $startTime )		$map[] = ['orders_product.insert_time','>=',strtotime($startTime)];
+		if( $endTime )			$map[] = ['orders_product.insert_time','<=',strtotime($endTime)];
+		if( $status )			$map[] = ['orders_product.status','=',$status];
         $session                = session('userRule');
         if ($session){
             $map[] = ['orders_product.company_id','=',$session['company_id']];
@@ -423,237 +425,241 @@ class Orders extends Auth{
                 $shopIds       = $Business::query()->where('leader_uid',$session['admin_uid'])->pluck('id')->toArray();
             }
         }
-        // 查询数据
-        $list					= $OrdersProduct->query()
-            ->join('custom','orders_product.custom_uid','=','custom.uid')
-            ->join('orders_addr','orders_addr.order_id','=','orders_product.order_id');
+		// 查询数据
+		$list					= $OrdersProduct->query()
+									->join('custom','orders_product.custom_uid','=','custom.uid')
+									->join('orders_addr','orders_addr.order_id','=','orders_product.order_id');
         if (isset($shopIds))    $list->whereIn('orders_product.business_id',$shopIds);
         $list                   = $list->where($map)
-            ->orderByDesc('orders_product.id')
-            ->select([
-                'orders_product.id as id',
-                'orders_product.order_id',
-                'orders_product.custom_uid',
-                'orders_product.product_id',
-                'orders_product.product_name',
-                'orders_product.sku_attr_names as product_spec',
-                'orders_product.product_thumb',
-                'orders_product.buy_num',
-                'orders_product.price_total',
-                'orders_product.coupon_total',
-                'orders_product.pay_total',
-                'orders_product.status',
-                'orders_product.insert_time',
-                'custom.username as custom_name','custom.weiban_extid as weiban_extid',
-                'orders_addr.contact_name','orders_addr.contact_shop','orders_addr.contact_phone','orders_addr.contact_province','orders_addr.contact_city','orders_addr.contact_area','orders_addr.contact_addr'
-            ])->get()->toArray();
-        // 返回结果
-        $data						= [];
-        // 循环处理数据
-        foreach ($list as $value) {
-            // id转编号
-            $value['order_id']		= $Model->idToCode($value['order_id']);
-            $value['status']		= $Model->getState($value['status'],'state');
-            $value['custom_uid']	= $Custom->idToCode($value['custom_uid']);
-            $value['product_price']	= $value['buy_num'] ? ($value['price_total'] / $value['buy_num']) : $value['buy_num'];
-            $value['pay_price']		= $value['buy_num'] ? ($value['pay_total'] / $value['buy_num']) : $value['buy_num'];
-            // 重组
-            $data[$value['order_id']]['order_id'] = $value['order_id'];
-            $data[$value['order_id']]['custom_uid'] = $value['custom_uid'];
-            $data[$value['order_id']]['custom_name'] = $value['custom_name'];
-            $data[$value['order_id']]['weiban_extid'] = $value['weiban_extid'];
-            $data[$value['order_id']]['status'] = $value['status'];
-            $data[$value['order_id']]['insert_time'] = $value['insert_time'];
-            // 地址
-            $data[$value['order_id']]['contact_name'] = $value['contact_name'];
-            $data[$value['order_id']]['contact_phone'] = $value['contact_phone'];
-            $data[$value['order_id']]['contact_province'] = $value['contact_province'];
-            $data[$value['order_id']]['contact_city'] = $value['contact_city'];
-            $data[$value['order_id']]['contact_area'] = $value['contact_area'];
-            $data[$value['order_id']]['contact_addr'] = $value['contact_addr'] .($value['contact_shop'] ? '【'.$value['contact_shop'].'】' : '');
-            // 子订单
-            $data[$value['order_id']]['product'][] 	  = ['product_id'=>$value['product_id'] ? $Product->idToCode($value['product_id']) : '— —','product_name'=>$value['product_name'],'product_spec'=>$value['product_spec'],'product_thumb'=>$value['product_thumb'],'product_price'=>$value['product_price'],'pay_price'=>$value['pay_price'],'buy_num'=>$value['buy_num'],'pay_total'=>$value['pay_total'],'price_total'=>$value['price_total'],'coupon_total'=>$value['coupon_total']];
-        }
+									->orderByDesc('orders_product.id')
+									->select([
+										'orders_product.id as id',
+										'orders_product.order_id',
+										'orders_product.custom_uid',
+										'orders_product.product_id',
+										'orders_product.product_name',
+										'orders_product.sku_attr_names as product_spec',
+										'orders_product.product_thumb',
+										'orders_product.buy_num',
+										'orders_product.price_total',
+										'orders_product.coupon_total',
+										'orders_product.pay_total',
+										'orders_product.status',
+										'orders_product.insert_time',
+										'custom.username as custom_name','custom.weiban_extid as weiban_extid',
+										'orders_addr.contact_name','orders_addr.contact_shop','orders_addr.shop_type','orders_addr.contact_phone','orders_addr.contact_province','orders_addr.contact_city','orders_addr.contact_area','orders_addr.contact_addr'
+									])->get()->toArray();
+		// 返回结果
+		$data						= [];
+		// 循环处理数据
+		foreach ($list as $value) {
+			// id转编号
+			$value['order_id']		= $Model->idToCode($value['order_id']);
+			$value['status']		= $Model->getState($value['status'],'state');
+			$value['custom_uid']	= $Custom->idToCode($value['custom_uid']);
+			$value['product_price']	= $value['buy_num'] ? ($value['price_total'] / $value['buy_num']) : $value['buy_num'];
+			$value['pay_price']		= $value['buy_num'] ? ($value['pay_total'] / $value['buy_num']) : $value['buy_num'];
+			// 重组
+			$data[$value['order_id']]['order_id'] = $value['order_id'];
+			$data[$value['order_id']]['custom_uid'] = $value['custom_uid'];
+			$data[$value['order_id']]['custom_name'] = $value['custom_name'];
+			$data[$value['order_id']]['weiban_extid'] = $value['weiban_extid'];
+			$data[$value['order_id']]['status'] = $value['status'];
+			$data[$value['order_id']]['insert_time'] = $value['insert_time'];
+			// 地址
+			$data[$value['order_id']]['contact_name'] = $value['contact_name'];
+			$data[$value['order_id']]['contact_phone'] = $value['contact_phone'];
+			$data[$value['order_id']]['contact_province'] = $value['contact_province'];
+			$data[$value['order_id']]['contact_city'] = $value['contact_city'];
+			$data[$value['order_id']]['contact_area'] = $value['contact_area'];
+			$data[$value['order_id']]['contact_addr'] = $value['contact_addr'] .($value['contact_shop'] ? '【'.$value['contact_shop'].'】' : '');
+			$data[$value['order_id']]['shop_type'] 	  = $value['shop_type'] ? $Shoptype->getOne($value['shop_type'],'name') : '';
+			// 子订单
+			$data[$value['order_id']]['product'][] 	  = ['product_id'=>$value['product_id'] ? $Product->idToCode($value['product_id']) : '— —','product_name'=>$value['product_name'],'product_spec'=>$value['product_spec'],'product_thumb'=>$value['product_thumb'],'product_price'=>$value['product_price'],'pay_price'=>$value['pay_price'],'buy_num'=>$value['buy_num'],'pay_total'=>$value['pay_total'],'price_total'=>$value['price_total'],'coupon_total'=>$value['coupon_total']];
+		}
 
-        try {
-            // 去下载
-            $this->toDown($data);
-        } catch (\Throwable $th) {
-            echo $th->getMessage();
-        }
-
-    }
+		try {
+			// 去下载
+			$this->toDown($data);
+		} catch (\Throwable $th) {
+			echo $th->getMessage();
+		}
+		
+	}
 
 
-    /**
-     * 去下载
-     */
-    private function  toDown($data){
-        // 创建新的电子表格对象
-        $spreadsheet			= new Spreadsheet();
-        // 设置合并单元格的行和列,例如合并A1到B2的单元格
-        $sheet					= $this->setStyle($spreadsheet);
-        // 从第二行写入
-        $row					= 2;
-        // 循环写入
-        foreach ($data as $value) {
-            // 循环产品
-            foreach ($value['product'] as $v) {
-                // 单元格内容写入
-                $sheet->setCellValue('A'.$row, $value['order_id']);
-                $sheet->setCellValue('B'.$row, $value['custom_uid']);
-                //避免 = + - 识别成公式
-                $sheet->setCellValueExplicit('C'.$row, $value['custom_name'],DataType::TYPE_STRING);
-                $sheet->setCellValue('D'.$row, $value['status']);
-                $sheet->setCellValue('E'.$row, $value['contact_name']);
-                $sheet->setCellValue('F'.$row, $value['contact_phone']);
-                $sheet->setCellValue('G'.$row, $value['contact_province']);
-                $sheet->setCellValue('H'.$row, $value['contact_city']);
-                $sheet->setCellValue('I'.$row, $value['contact_area']);
-                $sheet->setCellValue('J'.$row, $value['contact_addr']);
-                $sheet->setCellValue('K'.$row, $v['product_id']);
-                $sheet->setCellValue('L'.$row, $v['product_name']);
-                $sheet->setCellValue('M'.$row, $v['product_spec']);
-                $sheet->setCellValue('N'.$row, $v['product_price']);
-                $sheet->setCellValue('O'.$row, $v['pay_price']);
-                $sheet->setCellValue('P'.$row, $v['buy_num']);
-                $sheet->setCellValue('Q'.$row, $v['coupon_total']);
-                $sheet->setCellValue('R'.$row, $v['pay_total']);
-                $sheet->setCellValue('S'.$row, $value['weiban_extid']);
-                $sheet->setCellValue('T'.$row, date('Y-m-d H:i:s',$value['insert_time']));
-                // 函数自增
-                $row++;
-            }
-        }
-        // 创建内容
-        $writer 				= IOFactory::createWriter($spreadsheet, 'Xlsx');
-        header('Pragma: public');
-        header('Content-type:application/vnd.ms-excel');
-        header('Content-Disposition: inline;filename=下载订单.xlsx');
-        // 输出数据流
-        return $writer->save('php://output');
-    }
+	/**
+	 * 去下载
+	 */
+	private function  toDown($data){
+		// 创建新的电子表格对象
+		$spreadsheet			= new Spreadsheet();
+		// 设置合并单元格的行和列,例如合并A1到B2的单元格
+		$sheet					= $this->setStyle($spreadsheet);
+		// 从第二行写入
+		$row					= 2;
+		// 循环写入
+		foreach ($data as $value) {
+			// 循环产品
+			foreach ($value['product'] as $v) {
+				// 单元格内容写入
+				$sheet->setCellValue('A'.$row, $value['order_id']);
+				$sheet->setCellValue('B'.$row, $value['custom_uid']);
+				//避免 = + - 识别成公式
+				$sheet->setCellValueExplicit('C'.$row, $value['custom_name'],DataType::TYPE_STRING);
+				$sheet->setCellValue('D'.$row, $value['status']);
+				$sheet->setCellValue('E'.$row, $value['contact_name']);
+				$sheet->setCellValue('F'.$row, $value['contact_phone']);
+				$sheet->setCellValue('G'.$row, $value['contact_province']);
+				$sheet->setCellValue('H'.$row, $value['contact_city']);
+				$sheet->setCellValue('I'.$row, $value['contact_area']);
+				$sheet->setCellValue('J'.$row, $value['contact_addr']);
+				$sheet->setCellValue('K'.$row, $value['shop_type']);
+				$sheet->setCellValue('L'.$row, $v['product_id']);
+				$sheet->setCellValue('M'.$row, $v['product_name']);
+				$sheet->setCellValue('N'.$row, $v['product_spec']);
+				$sheet->setCellValue('O'.$row, $v['product_price']);
+				$sheet->setCellValue('P'.$row, $v['pay_price']);
+				$sheet->setCellValue('Q'.$row, $v['buy_num']);
+				$sheet->setCellValue('R'.$row, $v['coupon_total']);
+				$sheet->setCellValue('S'.$row, $v['pay_total']);
+				$sheet->setCellValue('T'.$row, $value['weiban_extid']);
+				$sheet->setCellValue('U'.$row, date('Y-m-d H:i:s',$value['insert_time']));
+				// 函数自增
+				$row++;
+			}
+		}
+		// 创建内容
+		$writer 				= IOFactory::createWriter($spreadsheet, 'Xlsx');
+		header('Pragma: public');
+		header('Content-type:application/vnd.ms-excel');
+		header('Content-Disposition: inline;filename=下载订单.xlsx');
+		// 输出数据流
+		return $writer->save('php://output');
+	}
 
-    /**
-     * 设置表格样式
-     *
-     */
-    private function setStyle(Spreadsheet $spreadsheet){
-        // 选择当前活动的工作表
-        $sheet					= $spreadsheet->getActiveSheet();
-        // 宽
-        $sheet->getColumnDimension('A')->setWidth(15);
-        $sheet->getColumnDimension('B')->setWidth(15);
-        $sheet->getColumnDimension('C')->setWidth(15);
-        $sheet->getColumnDimension('D')->setWidth(15);
-        $sheet->getColumnDimension('E')->setWidth(15);
-        $sheet->getColumnDimension('F')->setWidth(15);
-        $sheet->getColumnDimension('G')->setWidth(15);
-        $sheet->getColumnDimension('H')->setWidth(15);
-        $sheet->getColumnDimension('I')->setWidth(15);
-        $sheet->getColumnDimension('J')->setWidth(50);
-        $sheet->getColumnDimension('K')->setWidth(20);
-        $sheet->getColumnDimension('L')->setWidth(80);
-        $sheet->getColumnDimension('M')->setWidth(80);
-        $sheet->getColumnDimension('N')->setWidth(10);
-        $sheet->getColumnDimension('O')->setWidth(10);
-        $sheet->getColumnDimension('P')->setWidth(10);
-        $sheet->getColumnDimension('Q')->setWidth(10);
-        $sheet->getColumnDimension('R')->setWidth(10);
-        $sheet->getColumnDimension('S')->setWidth(50);
-        $sheet->getColumnDimension('T')->setWidth(20);
-        // 默认高度
-        $sheet->getDefaultRowDimension()->setRowHeight(18);
-        // 加粗第一行
-        $sheet->getStyle('A:T')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER)->setVertical(Alignment::VERTICAL_CENTER);
-        $sheet->getStyle('A1:T1')->getFont()->setBold(true);
-        $sheet->getStyle('A1:T1')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF00FF00'); // ARGB颜色代码,例如绿色
-        // 设置表格标题
-        $sheet
-            ->setCellValue('A1', '订单ID')
-            ->setCellValue('B1', '客户ID')
-            ->setCellValue('C1', '客户昵称')
-            ->setCellValue('D1', '订单状态')
-            ->setCellValue('E1', '收货人')
-            ->setCellValue('F1', '收货人手机号')
-            ->setCellValue('G1', '省')
-            ->setCellValue('H1', '市')
-            ->setCellValue('I1', '区县')
-            ->setCellValue('J1', '收货地址')
-            ->setCellValue('K1', '产品编码')
-            ->setCellValue('L1', '产品名称')
-            ->setCellValue('M1', '产品规格')
-            ->setCellValue('N1', '产品单价')
-            ->setCellValue('O1', '折后单价')
-            ->setCellValue('P1', '产品数量')
-            ->setCellValue('Q1', '优惠金额')
-            ->setCellValue('R1', '产品金额')
-            ->setCellValue('S1', '微伴ID')
-            ->setCellValue('T1', '下单时间');
-        // 返回结果
-        return 					$sheet;
-    }
+	/**
+	 * 设置表格样式
+	 * 
+	 */
+	private function setStyle(Spreadsheet $spreadsheet){
+		// 选择当前活动的工作表
+		$sheet					= $spreadsheet->getActiveSheet();
+		// 宽
+		$sheet->getColumnDimension('A')->setWidth(15);
+		$sheet->getColumnDimension('B')->setWidth(15);
+		$sheet->getColumnDimension('C')->setWidth(15);
+		$sheet->getColumnDimension('D')->setWidth(15);
+		$sheet->getColumnDimension('E')->setWidth(15);
+		$sheet->getColumnDimension('F')->setWidth(15);
+		$sheet->getColumnDimension('G')->setWidth(15);
+		$sheet->getColumnDimension('H')->setWidth(15);
+		$sheet->getColumnDimension('I')->setWidth(15);
+		$sheet->getColumnDimension('J')->setWidth(50);
+		$sheet->getColumnDimension('K')->setWidth(15);
+		$sheet->getColumnDimension('L')->setWidth(20);
+		$sheet->getColumnDimension('M')->setWidth(80);
+		$sheet->getColumnDimension('N')->setWidth(80);
+		$sheet->getColumnDimension('O')->setWidth(10);
+		$sheet->getColumnDimension('P')->setWidth(10);
+		$sheet->getColumnDimension('Q')->setWidth(10);
+		$sheet->getColumnDimension('R')->setWidth(10);
+		$sheet->getColumnDimension('S')->setWidth(10);
+		$sheet->getColumnDimension('T')->setWidth(50);
+		$sheet->getColumnDimension('U')->setWidth(20);
+		// 默认高度
+		$sheet->getDefaultRowDimension()->setRowHeight(18);
+		// 加粗第一行
+		$sheet->getStyle('A:U')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER)->setVertical(Alignment::VERTICAL_CENTER);
+		$sheet->getStyle('A1:U1')->getFont()->setBold(true);
+		$sheet->getStyle('A1:U1')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF00FF00'); // ARGB颜色代码,例如绿色
+		// 设置表格标题
+		$sheet
+		->setCellValue('A1', '订单ID')
+		->setCellValue('B1', '客户ID')
+		->setCellValue('C1', '客户昵称')
+		->setCellValue('D1', '订单状态')
+		->setCellValue('E1', '收货人')
+		->setCellValue('F1', '收货人手机号')
+		->setCellValue('G1', '省')
+		->setCellValue('H1', '市')
+		->setCellValue('I1', '区县')
+		->setCellValue('J1', '收货地址')
+		->setCellValue('K1', '终端类型')
+		->setCellValue('L1', '产品编码')
+		->setCellValue('M1', '产品名称')
+		->setCellValue('N1', '产品规格')
+		->setCellValue('O1', '产品单价')
+		->setCellValue('P1', '折后单价')
+		->setCellValue('Q1', '产品数量')
+		->setCellValue('R1', '优惠金额')
+		->setCellValue('S1', '产品金额')
+		->setCellValue('T1', '微伴ID')
+		->setCellValue('U1', '下单时间');
+		// 返回结果
+		return 					$sheet;
+	}
 
-    /**
-     * 分享图片
-     *
-     */
-    private function getShareImage($shopName,$score=0){
-        // 尝试执行
-        try {
-            // 加载图片
-            $image		= Image::make(public_path('uploads/images/default/').'order_receipt_share.jpg');
-            // 加载图片
-            $qrcode		= Image::make(public_path('uploads/images/default/').'mp_qrcode.jpg')->resize(100,100);
-            // 设置文字样式(字体、大小、颜色等)
-            $fontPath	= public_path().'/fonts/msyh14.ttf';// 指定字体文件路径
-            // 文本
-            $score 		= $score ? '即将获得'.$score.'积分' : '';
+	/**
+	 * 分享图片
+	 * 
+	 */
+	private function getShareImage($shopName,$score=0){
+		// 尝试执行
+		try {
+			// 加载图片
+			$image		= Image::make(public_path('uploads/images/default/').'order_receipt_share.jpg');
+			// 加载图片
+			$qrcode		= Image::make(public_path('uploads/images/default/').'mp_qrcode.jpg')->resize(100,100);
+			// 设置文字样式(字体、大小、颜色等)
+			$fontPath	= public_path().'/fonts/msyh14.ttf';// 指定字体文件路径
+			// 文本
+			$score 		= $score ? '即将获得'.$score.'积分' : '';
 
-            // 给图片写入文字
-            $image->text('恭喜 '.$shopName, 240,60,function (Font $font) use ($fontPath) {
-                $font->file($fontPath);		// 字体文件地址
-                $font->size(24);			// 字体大小
-                $font->color('#FFFFFF');
-                $font->align('center');
-            });
+			// 给图片写入文字
+			$image->text('恭喜 '.$shopName, 240,60,function (Font $font) use ($fontPath) {
+				$font->file($fontPath);		// 字体文件地址
+				$font->size(24);			// 字体大小
+				$font->color('#FFFFFF');
+				$font->align('center');
+			});
 
-            // 给图片写入文字
-            $image->text('完成了一笔订单', 240,100,function (Font $font) use ($fontPath) {
-                $font->file($fontPath);		// 字体文件地址
-                $font->size(24);			// 字体大小
-                $font->color('#FFFFFF');
-                $font->align('center');
-            });
-            // 是否有积分
-            if( $score ){
-                // 给图片写入文字
-                $image->text($score, 240,140,function (Font $font) use ($fontPath) {
-                    $font->file($fontPath);		// 字体文件地址
-                    $font->size(24);			// 字体大小
-                    $font->color('#FFFFFF');
-                    $font->align('center');
-                });
-            }
-            // 给图片写入文字
-            $image->text('你也来试试吧', 240,$score?180:140,function (Font $font) use ($fontPath) {
-                $font->file($fontPath);		// 字体文件地址
-                $font->size(24);			// 字体大小
-                $font->color('#FFFFFF');
-                $font->align('center');
-            });
-            // 插入图片
-            $image->insert($qrcode,'bottom-right',10,10);
-            // 转码成字符串
-            $image		= $image->encode('jpg', 90)->__toString();
-            // 转base64
-            $base64		= 'data:image/jpg;base64,' . base64_encode($image);
+			// 给图片写入文字
+			$image->text('完成了一笔订单', 240,100,function (Font $font) use ($fontPath) {
+				$font->file($fontPath);		// 字体文件地址
+				$font->size(24);			// 字体大小
+				$font->color('#FFFFFF');
+				$font->align('center');
+			});
+			// 是否有积分
+			if( $score ){
+				// 给图片写入文字
+				$image->text($score, 240,140,function (Font $font) use ($fontPath) {
+					$font->file($fontPath);		// 字体文件地址
+					$font->size(24);			// 字体大小
+					$font->color('#FFFFFF');
+					$font->align('center');
+				});
+			}
+			// 给图片写入文字
+			$image->text('你也来试试吧', 240,$score?180:140,function (Font $font) use ($fontPath) {
+				$font->file($fontPath);		// 字体文件地址
+				$font->size(24);			// 字体大小
+				$font->color('#FFFFFF');
+				$font->align('center');
+			});
+			// 插入图片
+			$image->insert($qrcode,'bottom-right',10,10);
+			// 转码成字符串
+			$image		= $image->encode('jpg', 90)->__toString();
+			// 转base64
+			$base64		= 'data:image/jpg;base64,' . base64_encode($image);
 
-            return		$base64;
-        } catch (\Throwable $th) {
-            // 返回路径
-            return 			'';
-        }
-    }
+			return		$base64;
+		} catch (\Throwable $th) {
+			// 返回路径
+			return 			'';
+		}
+	}
 
-}
+}

+ 174 - 10
app/Http/Controllers/Admin/Product.php

@@ -16,6 +16,9 @@ use App\Models\Product\City as ProductCity;
 use App\Models\ProductPhoto;
 use Illuminate\Support\Facades\DB;
 use App\Models\WeiBan\Tags as WeiBanTags;
+use Intervention\Image\Facades\Image;
+use Intervention\Image\Gd\Font;
+use App\Facades\Servers\WechatMini\Mini;
 
 /**
  * 产品管理
@@ -123,6 +126,100 @@ class Product extends Auth{
 		return $this->fetch();
     }
 
+	/**
+	 * 获取小程序海报
+	 * 
+	 */
+	public function get_poster(Model $Model){
+		// 接收参数
+		$id								= request('id',0);
+		// // 查询用户
+		$oldData						= $Model->where(['id'=>$id])->first();
+		// // 错误告知
+		if( !$oldData )					return $this->error('查无数据');
+		// url有效期
+		$urlLink						= '';//$this->getUrlLink($id);
+		// 获取分享海报图片
+		$result 						= $this->getShareImage('id='.$id,$oldData);
+		// 错误提示
+		if( isset($result['error']) )	return $this->error($result['error']);
+		// 分配数据
+		$this->assign('image',$result);
+		$this->assign('urlLink',$urlLink);
+		$this->assign('oldData',$oldData);
+		$this->assign('crumbs','海报');
+		// 加载模板
+		return 							$this->fetch();
+	}
+
+	/**
+	 * 获取小程序链接
+	 * 
+	 */
+	private function getUrlLink($id){
+		// 结果数据
+        $link                  = cache('admin:product:urllink:product_id'.$id);
+        // 不存在数据
+        if ( is_null($link) ) {
+            // 从数据库获取数据
+            $link              = Mini::getUrlLink('pages/product/index','product_id='.$id);
+            // 存起来
+            cache(['admin:product:urllink:product_id'.$id=>$link],$link ? now()->addDays(23) : now()->addMinutes(3));
+        }
+        // 返回结果
+        return                  $link;
+	}
+
+	/**
+	 * 获取分享海报图片
+	 * @param  int $scene  场景值
+	 * 
+	 */
+	private function getShareImage($scene,$oldData){
+		// 尝试执行
+		try {
+			// 加载图片
+			$image							= Image::make(public_path('uploads/images/poster/').'product.png');
+			// 产品缩略图
+			$thumb							= Image::make(path_compat($oldData['thumb']))->resize(1000,1000);
+			// 设置文字样式(字体、大小、颜色等)
+			$fontPath						= public_path().'/fonts/msyh14.ttf';// 指定字体文件路径
+			// 生成小程序二维码
+			$qrcode							= Mini::getUnlimit($scene,['page'=>'pages/product/index','width'=>280,'is_hyaline'=>true]);
+			// 错误提示
+			if( isset($qrcode['error']) )	return $qrcode;
+			// 加载图片
+			$qrcode							= Image::make($qrcode)->resize(250,250);
+			// 插入图片
+			$image->insert($thumb,'top-center',0,130);
+			// 插入图片
+			$image->insert($qrcode,'bottom-left',120,120);
+			// 给图片写入文字
+			$image->text('¥'.$oldData['price'], 360,1280,function (Font $font) use ($fontPath) {
+				$font->file($fontPath);		// 字体文件地址
+				$font->size(88);			// 字体大小
+				$font->color('#333333');
+				$font->align('left');
+			});
+			// 给图片写入文字
+			$image->text($oldData['name'], 120,1380,function (Font $font) use ($fontPath) {
+				$font->file($fontPath);		// 字体文件地址
+				$font->size(48);			// 字体大小
+				$font->color('#333333');
+				$font->align('left');
+			});
+			// 转码成字符串
+			$image							= $image->encode('jpg', 90)->__toString();
+			// 转base64
+			$base64							= 'data:image/jpg;base64,' . base64_encode($image);
+			// 返回结果
+			return							$base64;
+		} catch (\Throwable $th) {
+			// 错误提示
+			return 							['error'=>$th->getMessage()];
+		}
+	}
+
 	/**
 	 * 添加
 	 * 
@@ -141,6 +238,7 @@ class Product extends Auth{
 			$data['producer_id']	= request('producer_id',0);
 			$data['business_id']	= request('business_id',0);
 			$data['quota']			= request('quota',0);
+			$data['min_quota']		= request('min_quota',0);
 			$data['quota_start']	= request('quota_start','');
 			$data['quota_end']		= request('quota_end','');
 			$data['puton_time']		= request('puton_time','');
@@ -178,6 +276,24 @@ class Product extends Auth{
 			if( $attr && !$skuList ) return json_send(['code'=>'error','msg'=>'规格属性存在时,请填写SKU','data'=>['error'=>'规格属性存在时,请填写SKU']]);
 			// 限购提示
 			if( $data['quota'] && ( !$data['quota_start'] || !$data['quota_end'] )) 	return json_send(['code'=>'error','msg'=>'限购必填限购时间','data'=>['error'=>'限购必填限购时间']]);
+			// 限购提示
+			if( $data['min_quota'] > $data['quota'] ) 	return json_send(['code'=>'error','msg'=>'起购数量请勿大于限购数量','data'=>['error'=>'起购数量请勿大于限购数量']]);
+			// SKU存在的时候,判断限购数量
+			if( $skuList )			{
+				// 循环处理
+				foreach ($skuList as $attrNames => $value) {
+					// SKU限购,所以限购时间也必须填
+					if( $value['quota'] && ( !$data['quota_start'] || !$data['quota_end'] )) return json_send(['code'=>'error','msg'=>'SKU限购时,请填限购时间','data'=>['error'=>'SKU限购时,请填限购时间']]);
+					// 限购提示
+					if( $value['min_quota'] > $value['quota'] ) 	return json_send(['code'=>'error','msg'=>$attrNames.'起购数量请勿大于限购数量','data'=>['error'=>$attrNames.'起购数量请勿大于限购数量']]);
+					// 提示起购数量异常,如果总起购数量小于SKU起购数量,提示
+					if( $value['min_quota'] && $value['min_quota'] < $data['min_quota'] ) return json_send(['code'=>'error','msg'=>'SKU的起购数量不能小于总起购数量','data'=>['error'=>'SKU的起购数量不能小于总起购数量']]);
+				}
+				// 限购数量
+				$quota 				= array_sum(array_column($skuList,'quota'));
+				// 提示限购数量异常
+				if( $data['quota']&& $data['quota'] < $quota ) 	return json_send(['code'=>'error','msg'=>'总限购数量不能小于SKU的限购数量','data'=>['error'=>'总限购数量不能小于SKU的限购数量']]);
+			}
 			// 上下架
 			if( $data['puton_time'] ) 	{
 				// 下架时间必填
@@ -189,6 +305,8 @@ class Product extends Auth{
 			if( $skuList )			$data['stock'] = array_sum(array_column($skuList,'stock'));
 			// 总库存
 			$data['stock_total']	= $data['stock'];
+			// 总库存提醒
+			if( $data['stock_total'] <= 0 ) return json_send(['code'=>'error','msg'=>'请设置库存','data'=>['error'=>'请设置库存']]);
 			// 获取规格属性
 			$specAttr				= $this->getSpecAttr($attr,$ProductSpec,true);
 			// 开启事务
@@ -334,6 +452,11 @@ class Product extends Auth{
 	 * 
 	 * */
 	public function edit(Request $request, Model $Model, WeiBanTags $WeiBanTags, ProductPhoto $ProductPhoto, Producer $Producer, Business $Business, ProductType $ProductType, ProductSpec $ProductSpec, ProductAttr $ProductAttr, ProductSkus $ProductSkus, City $City, ProductCity $ProductCity){
+		// 接收参数
+		$id							= request('id',0);
+		// 查询数据
+		$oldData					= $Model->where(['id'=>$id])->first();
+		// 修改
 		if(request()->isMethod('post')){
 			// 验证参数
 			$request->scene('edit')->validate();
@@ -346,6 +469,7 @@ class Product extends Auth{
 			$data['price']			= request('price',0);
 			$data['market_price']	= request('market_price',0);
 			$data['quota']			= request('quota',0);
+			$data['min_quota']		= request('min_quota',0);
 			$data['quota_start']	= request('quota_start','');
 			$data['quota_end']		= request('quota_end','');
 			$data['puton_time']		= request('puton_time','');
@@ -380,6 +504,24 @@ class Product extends Auth{
 			if( $attr && !$skuList ) return json_send(['code'=>'error','msg'=>'规格属性存在时,请填写SKU','data'=>['error'=>'规格属性存在时,请填写SKU']]);
 			// 限购提示
 			if( $data['quota'] && ( !$data['quota_start'] || !$data['quota_end'] )) 	return json_send(['code'=>'error','msg'=>'限购必填限购时间','data'=>['error'=>'限购必填限购时间']]);
+			// 限购提示
+			if( $data['min_quota'] > $data['quota'] ) 	return json_send(['code'=>'error','msg'=>'起购数量请勿大于限购数量','data'=>['error'=>'起购数量请勿大于限购数量']]);
+			// SKU存在的时候,判断限购数量
+			if( $skuList )			{
+				// 循环处理
+				foreach ($skuList as $attrNames => $value) {
+					// SKU限购,所以限购时间也必须填
+					if( $value['quota'] && ( !$data['quota_start'] || !$data['quota_end'] )) 	return json_send(['code'=>'error','msg'=>'SKU限购时,请填限购时间','data'=>['error'=>'SKU限购时,请填限购时间']]);
+					// 限购提示
+					if( $value['min_quota'] > $value['quota'] ) 	return json_send(['code'=>'error','msg'=>$attrNames.'起购数量请勿大于限购数量','data'=>['error'=>$attrNames.'起购数量请勿大于限购数量']]);
+					// 提示起购数量异常,如果总起购数量小于SKU起购数量,提示
+					if( $value['min_quota'] && $value['min_quota'] < $data['min_quota'] ) 	return json_send(['code'=>'error','msg'=>'SKU的起购数量不能小于总起购数量','data'=>['error'=>'SKU的起购数量不能小于总起购数量']]);
+				}
+				// 限购数量
+				$quota 				= array_sum(array_column($skuList,'quota'));
+				// 提示限购数量异常
+				if( $data['quota']&& $data['quota'] < $quota ) 	return json_send(['code'=>'error','msg'=>'总限购数量不能小于SKU的限购数量','data'=>['error'=>'总限购数量不能小于SKU的限购数量']]);
+			}
 			// 上下架
 			if( $data['puton_time'] ) 	{
 				// 下架时间必填
@@ -391,6 +533,8 @@ class Product extends Auth{
 			if( $skuList )			$data['stock'] = array_sum(array_column($skuList,'stock'));
 			// 总库存
 			$data['stock_total']	= $data['stock'];
+			// 总库存提醒
+			if( $data['stock_total'] <= 0 ) return json_send(['code'=>'error','msg'=>'请设置库存','data'=>['error'=>'请设置库存']]);
 			// 获取规格属性
 			$specAttr				= $this->getSpecAttr($attr,$ProductSpec,true);
 			// 开启事务
@@ -486,7 +630,7 @@ class Product extends Auth{
 				// 提交
 				DB::commit();
 				// 记录行为
-				$this->addAdminHistory(admin('uid'),$Model->getTable(),$id,2,[],$data);
+				$this->addAdminHistory(admin('uid'),$Model->getTable(),$id,2,$oldData,$data);
 				// 告知结果
 				return					json_send(['code'=>'success','msg'=>'修改成功','action'=>'edit']);
 			} catch (\Throwable $th) {
@@ -496,10 +640,6 @@ class Product extends Auth{
 				return 				json_send(['code'=>'error','msg'=>'系统异常,写入失败','data'=>$th->getMessage() .'=>'.$th->getLine()]);
 			}	
 		}
-		// 接收参数
-		$id							= request('id',0);
-		// 查询数据
-		$oldData					= $Model->where(['id'=>$id])->first();
 		// 如果是没有数据
 		if( !$oldData ) 			return $this->error('查无数据');
 		// 产品信息转格式
@@ -582,6 +722,7 @@ class Product extends Auth{
 			$data['producer_id']	= request('producer_id',0);
 			$data['business_id']	= request('business_id',0);
 			$data['quota']			= request('quota',0);
+			$data['min_quota']		= request('min_quota',0);
 			$data['quota_start']	= request('quota_start','');
 			$data['quota_end']		= request('quota_end','');
 			$data['stock']			= request('stock',0);
@@ -611,10 +752,30 @@ class Product extends Auth{
 			if( $attr && !$skuList ) return json_send(['code'=>'error','msg'=>'规格属性存在时,请填写SKU','data'=>['error'=>'规格属性存在时,请填写SKU']]);
 			// 限购提示
 			if( $data['quota'] && ( !$data['quota_start'] || !$data['quota_end'] )) 	return json_send(['code'=>'error','msg'=>'限购必填限购时间','data'=>['error'=>'限购必填限购时间']]);
+			// 限购提示
+			if( $data['min_quota'] > $data['quota'] ) 	return json_send(['code'=>'error','msg'=>'起购数量请勿大于限购数量','data'=>['error'=>'起购数量请勿大于限购数量']]);
 			// 总库存
 			if( $skuList )			$data['stock'] = array_sum(array_column($skuList,'stock'));
+			// SKU存在的时候,判断限购数量
+			if( $skuList )			{
+				// 循环处理
+				foreach ($skuList as $attrNames => $value) {
+					// SKU限购,所以限购时间也必须填
+					if( $value['quota'] && ( !$data['quota_start'] || !$data['quota_end'] )) 	return json_send(['code'=>'error','msg'=>'SKU限购时,请填限购时间','data'=>['error'=>'SKU限购时,请填限购时间']]);
+					// 限购提示
+					if( $value['min_quota'] > $value['quota'] ) 	return json_send(['code'=>'error','msg'=>$attrNames.'起购数量请勿大于限购数量','data'=>['error'=>$attrNames.'起购数量请勿大于限购数量']]);
+					// 提示起购数量异常,如果总起购数量小于SKU起购数量,提示
+					if( $value['min_quota'] && $value['min_quota'] < $data['min_quota'] ) 	return json_send(['code'=>'error','msg'=>'SKU的起购数量不能小于总起购数量','data'=>['error'=>'SKU的起购数量不能小于总起购数量']]);
+				}
+				// 限购数量
+				$quota 				= array_sum(array_column($skuList,'quota'));
+				// 提示限购数量异常
+				if( $data['quota'] && $data['quota'] < $quota ) 	return json_send(['code'=>'error','msg'=>'总限购数量不能小于SKU的限购数量','data'=>['error'=>'总限购数量不能小于SKU的限购数量']]);
+			}
 			// 总库存
 			$data['stock_total']	= $data['stock'];
+			// 总库存提醒
+			if( $data['stock_total'] <= 0 ) return json_send(['code'=>'error','msg'=>'请设置库存','data'=>['error'=>'请设置库存']]);
 			// 获取规格属性
 			$specAttr				= $this->getSpecAttr($attr,$ProductSpec,true);
 			// 开启事务
@@ -862,15 +1023,18 @@ class Product extends Auth{
 		// 循环规格属性
 		foreach ($skuList as $newKey => $new) {
 			// 获取新数据
-			$new		= ['attr_names'=>$new,'price'=>0,'stock'=>0,'status'=>0,'sku_thumb'=>''];
+			$new		= ['attr_names'=>$new,'price'=>0,'market_price'=>0,'stock'=>0,'min_quota'=>0,'quota'=>0,'status'=>0,'sku_thumb'=>''];
 			// 循环旧的sku
 			foreach ($oldSkus as $old) {
 				// 如果有相等的规格
 				if( $old['attr_names'] == $new['attr_names']) {
-					$new['sku_thumb']= $old['sku_thumb'];
-					$new['price']	= $old['price'];
-					$new['stock']	= $old['stock'];
-					$new['status']	= $old['status'];
+					$new['sku_thumb']	= $old['sku_thumb'];
+					$new['market_price']= $old['market_price'];
+					$new['price']		= $old['price'];
+					$new['stock']		= $old['stock'];
+					$new['status']		= $old['status'];
+					$new['min_quota']	= $old['min_quota'];
+					$new['quota']	= $old['quota'];
 				}
 			}
 			$skuList[$newKey]	= $new;

+ 55 - 4
app/Http/Controllers/Admin/RecruitmentActive.php

@@ -5,9 +5,8 @@ use App\Http\Requests\Admin\RecruitmentActive as Request;
 use App\Models\RecruitmentActive as Model;
 use App\Models\City;
 use App\Models\WeiBan\Tags as WeiBanTags;
-
-
-use function PHPUnit\Framework\isNull;
+use Illuminate\Support\Facades\DB;
+use Intervention\Image\Facades\Image;
 
 /**
  * 拉新活动
@@ -93,13 +92,65 @@ class RecruitmentActive extends Auth{
         // 不存在数据
         if ( is_null($link) ) {
             // 从数据库获取数据
-            $link              = Mini::getUrlLink('pages/recruitment/index','?id='.$id);
+            $link              = Mini::getUrlLink('pages/recruitment/index','id='.$id);
             // 存起来
             cache(['admin:recruitment:active:urllink:'.$id=>$link],$link ? now()->addDays(28) : now()->addMinutes(3));
         }
         // 返回结果
         return                  $link;
+	}
+
+	/**
+	 * 获取小程序海报
+	 * 
+	 */
+	public function get_poster(Model $Model){
+		// 接收参数
+		$id								= request('id',0);
+		// 查询用户
+		$oldData						= $Model->where(['id'=>$id])->first();
+		// 错误告知
+		if( !$oldData )					return $this->error('查无数据');
+		// 获取分享海报图片
+		$result 						= $this->getShareImage('id='.$id);
+		// 错误提示
+		if( isset($result['error']) )	return $this->error($result['error']);
+		// 分配数据
+		$this->assign('image',$result);
+		$this->assign('oldData',$oldData);
+		$this->assign('crumbs','海报');
+		// 加载模板
+		return 							$this->fetch();
+	}
 
+	/**
+	 * 获取分享海报图片
+	 * @param  int $scene  场景值
+	 * 
+	 */
+	private function getShareImage($scene){
+		// 尝试执行
+		try {
+			// 加载图片
+			$image							= Image::make(public_path('uploads/images/poster/').'recruitment.png');
+			// 生成小程序二维码
+			$qrcode							= Mini::getUnlimit($scene,['page'=>'pages/recruitment/index','width'=>480,'is_hyaline'=>true]);
+			// 错误提示
+			if( isset($qrcode['error']) )	return $qrcode;
+			// 加载图片
+			$qrcode							= Image::make($qrcode);
+			// 插入图片
+			$image->insert($qrcode,'bottom-center',0,345);
+			// 转码成字符串
+			$image							= $image->encode('jpg', 90)->__toString();
+			// 转base64
+			$base64							= 'data:image/jpg;base64,' . base64_encode($image);
+			// 返回结果
+			return							$base64;
+		} catch (\Throwable $th) {
+			// 错误提示
+			return 							['error'=>$th->getMessage()];
+		}
 	}
 
 	/**

+ 56 - 4
app/Http/Controllers/Admin/ScoreClockinActive.php

@@ -7,7 +7,7 @@ use App\Models\Score\ClockinActive as Model;
 use App\Models\Score\Clockin as Clockin;
 use App\Models\WeiBan\Tags as WeiBanTags;
 use Illuminate\Support\Facades\DB;
-
+use Intervention\Image\Facades\Image;
 
 /**
  * 打卡活动
@@ -27,7 +27,7 @@ class ScoreClockinActive extends Auth{
      * 列表页
      *
      * */
-    public function index(Request $request, Model $Model, City $City){
+    public function index( Model $Model, City $City){
         // 接收参数
         $name					= request('name','');
         // 查询条件
@@ -73,15 +73,67 @@ class ScoreClockinActive extends Auth{
         // 不存在数据
         if ( is_null($link) ) {
             // 从数据库获取数据
-            $link              = Mini::getUrlLink('pages/clockin/active','?id='.$id);
+            $link              = Mini::getUrlLink('pages/score/clockin','id='.$id);
             // 存起来
             cache(['admin:clockin:active:urllink:'.$id=>$link],$link ? now()->addDays(28) : now()->addMinutes(3));
         }
         // 返回结果
         return                  $link;
-
     }
 
+    /**
+	 * 获取小程序海报
+	 * 
+	 */
+	public function get_poster(Model $Model){
+		// 接收参数
+		$id								= request('id',0);
+		// 查询用户
+		$oldData						= $Model->where(['id'=>$id])->first();
+		// 错误告知
+		if( !$oldData )					return $this->error('查无数据');
+		// 获取分享海报图片
+		$result 						= $this->getShareImage('id='.$id);
+		// 错误提示
+		if( isset($result['error']) )	return $this->error($result['error']);
+		// 分配数据
+		$this->assign('image',$result);
+		$this->assign('oldData',$oldData);
+		$this->assign('crumbs','海报');
+		// 加载模板
+		return 							$this->fetch();
+	}
+
+	/**
+	 * 获取分享海报图片
+	 * @param  int $scene  场景值
+	 * 
+	 */
+	private function getShareImage($scene){
+		// 尝试执行
+		try {
+			// 加载图片
+			$image							= Image::make(public_path('uploads/images/poster/').'score_clockin.png');
+			// 生成小程序二维码
+			$qrcode							= Mini::getUnlimit($scene,['page'=>'pages/score/clockin','width'=>280,'is_hyaline'=>true]);
+			// 错误提示
+			if( isset($qrcode['error']) )	return $qrcode;
+			// 加载图片
+			$qrcode							= Image::make($qrcode);
+			// 插入图片
+			$image->insert($qrcode,'bottom-right',60,80);
+			// 转码成字符串
+			$image							= $image->encode('jpg', 90)->__toString();
+			// 转base64
+			$base64							= 'data:image/jpg;base64,' . base64_encode($image);
+			// 返回结果
+			return							$base64;
+		} catch (\Throwable $th) {
+			// 错误提示
+			return 							['error'=>$th->getMessage()];
+		}
+	}
+
     /**
      * 添加
      *

+ 128 - 1
app/Http/Controllers/Admin/WeibanExternal.php

@@ -1,9 +1,12 @@
 <?php namespace App\Http\Controllers\Admin;
 
+use App\Facades\Servers\WeiBan\OpenApi;
 use App\Models\Custom;
 use App\Models\WeiBan\External as Model;
 use App\Models\WeiBan\Tags as WeiBanTags;
+use App\Models\WeiBan\Taglist as Taglist;
 use Illuminate\Support\Carbon;
+use Illuminate\Support\Facades\DB;
 
 /**
  * 客户管理
@@ -68,6 +71,130 @@ class WeibanExternal extends Auth{
 		return 					$this->fetch();
     }
 
-
+	/**
+	 * 打标签
+	 * 
+	 */
+	public function mark_tags(Model $Model,WeiBanTags $WeiBanTags, Taglist $Taglist){
+		// 接受参数
+		$extUserid				= request('weiban_extid', '');
+		$staffId				= request('staff_id', '');
+		// 查询条件
+		$map 					= [];
+		// 编码ID
+		if ($extUserid)			$map[] = ['weiban_external.id', '=', $extUserid];
+		if ($staffId)			$map[] = ['weiban_follow.staff_id', '=', $staffId];
+		// 查询数据
+		$oldData				= $Model->query()->join('weiban_follow','weiban_follow.weiban_extid','=','weiban_external.id')->where($map)->first(['weiban_external.*','weiban_follow.staff_id','weiban_follow.staff_name','weiban_follow.remark','weiban_follow.remark_corp_name','weiban_follow.phone_number']);
+		// 修改
+		if( request()->isMethod('post') ){
+			// 如果数据不存在
+			if( !$oldData )			return json_send(['code'=>'error','msg'=>'查无该客户信息']);
+			// 数据处理
+			$oldData				= $oldData->toArray();
+			// 组合数据
+			$tags					= request('tags',[]);
+			// 获取客户的原来标签
+			$oldData				= $WeiBanTags->getListByWeibanExtid($oldData['id']);
+			// 获取标签数据
+			$oldTags				= array_column($oldData,'name');
+			// 原标签对比新标签多出来的,移除
+			$rmTags					= array_diff($oldTags,$tags);
+			// 新标签对比原标签多出来的,新增
+			$addTags				= array_diff($tags,$oldTags);
+			// 获取标签数据
+			$tagList				= $Taglist->getListByItem();
+			// 循环需要移除的标签,获取对应的tagid
+			$markTag['add_tag_id_list'] = [];
+			$markTag['remove_tag_id_list'] = [];
+			// 循环处理
+			foreach ( $tagList as $tag ) {
+				// 新增的
+				if(  in_array($tag['tag_name'],$addTags) ) $markTag['add_tag_id_list'][] = $tag['tag_id'];
+				// 移除的
+				if(  in_array($tag['tag_name'],$rmTags) ) $markTag['remove_tag_id_list'][] = $tag['tag_id'];
+			}
+			// 提示
+			if( !$markTag['add_tag_id_list'] && !$markTag['remove_tag_id_list'] ){
+				// 提示
+				return 				json_send(['code'=>'error','msg'=>'标签未改变']);
+			}
+			// 微伴ID
+			$markTag['external_user_id']= $extUserid;
+			$markTag['staff_id']		= $staffId;
+			// 修改数据
+			foreach ($addTags as $key => $value) {
+				// 循环处理
+				foreach ( $tagList as $tag ) {
+					// 如果数据匹配
+					if( $tag['tag_name'] == $value ) {
+						// 重组添加数据
+						$value				= ['weiban_extid'=>$extUserid,'staff_id'=>$staffId,'name'=>$tag['tag_name'],'group'=>$tag['tag_group_name'],'update_time'=>time()];
+						// 重组添加数据
+						$addTags[$key]		= $value;
+						// 跳出循环
+						break;
+					}
+				}
+			}
+			// 事务
+			DB::beginTransaction();
+			// 尝试执行代码
+			try {
+				// 添加标签
+				$result 				= $markTag['add_tag_id_list'] ? $WeiBanTags->query()->insert($addTags) : true;
+				// 修改结果
+				if( !$result )			{
+					// 回滚
+					DB::rollBack();
+					// 提示
+					return 				json_send(['code'=>'error','msg'=>'客户标签添加失败']);
+				}
+				// 删除标签
+				$result 				= $markTag['remove_tag_id_list'] ? $WeiBanTags->query()->whereIn('name',$rmTags)->where([['weiban_extid','=',$extUserid],['staff_id','=',$staffId]])->delete() : true;
+				// 修改结果
+				if( !$result )			{
+					// 回滚
+					DB::rollBack();
+					// 提示
+					return 				json_send(['code'=>'error','msg'=>'客户标签移除失败']);
+				}
+				// 企微打标签
+				$result 				= OpenApi::markTags($extUserid,$markTag['add_tag_id_list'],$markTag['remove_tag_id_list'],$staffId);
+				// 修改结果
+				if( !$result )			{
+					// 回滚
+					DB::rollBack();
+					// 提示
+					return 				json_send(['code'=>'error','msg'=>'客户标签同步失败']);
+				}
+				// 提交
+				DB::commit();
+				// 告知结果
+				return					json_send(['code'=>'success','msg'=>'客户标签成功','action'=>'add']);
+			} catch (\Throwable $th)	{
+				// 回滚
+				DB::rollBack();
+				// 修改结果
+				return					json_send(['code'=>'error','msg'=>'客户标签标记失败','data'=>['error'=>$th->getMessage()]]);
+			}
+		}
+		// 如果数据不存在
+		if( !$oldData )			return $this->error('查无该客户信息');
+		// 数据处理
+		$oldData				= $oldData->toArray();
+		// 获取标签
+		$oldData['tags']		= $WeiBanTags->getListByWeibanExtid($oldData['id']);
+		// 获取标签数据
+		$oldData['tags']		= array_column($oldData['tags'],'name');
+		// 获取标签数据
+		$tagList				= $Taglist->getList();
+		// 分配数据
+		$this->assign('crumbs','客户标签');
+		$this->assign('oldData', $oldData);
+		$this->assign('tagList', $tagList);
+		// 加载模板
+		return 					$this->fetch();
+	}
 
 }

+ 26 - 0
app/Http/Controllers/Api/Custom.php

@@ -68,6 +68,7 @@ class Custom extends Api{
 											'username'=>$custom['username'],
 											'userpic'=>$custom['userpic'],
 											'phone'=>$custom['phone'],
+											'is_manager'=>$custom['is_manager'],
 											'company_id'=>1, // 无需验证资质
 											'show_price'=>$cityId?1:0, // 是否选择了城市处理
 											'city_id'=>$cityId,
@@ -103,5 +104,30 @@ class Custom extends Api{
 		return							json_send(['code'=>'success','msg'=>'保存成功','data'=>['city_id'=>$cityId]]);
 	}
 
+	/**
+	 * 设置信息			/api/custom/get_city
+	 * 
+	 * @param	string		$code		授权码
+	 * 
+	 * */
+	public function get_city(Request $request,Model $Model,City $City){
+		// 接口验签
+		// $this->verify_sign();
+		// 验证参数
+		$request->scene('get_city')->validate();
+		// 检查登录
+		$uid							= $this->checkLogin();
+		// 查询用户
+		$custom							= $Model->getOne($uid);
+		// 用户不存在
+		if( empty($custom) )			return json_send(['code'=>'success','msg'=>'获取成功','data'=>['province'=>'','city'=>'']]);
+		// 获取城市ID
+		$cityId							= $custom['city_id'];
+		$cityName						= $City->getOne($cityId,'name');
+		$pid 							= $City->getOne($cityId,'pid');
+		$province						= $City->getOne($pid,'name');
+		// 返回结果
+		return 							json_send(['code'=>'success','msg'=>'获取成功','data'=>['province'=>(string)$province,'city'=>(string)$cityName]]);
+	}
 
 }

+ 2 - 0
app/Http/Controllers/Api/CustomAddr.php

@@ -52,6 +52,7 @@ class CustomAddr extends Api{
 		$data['contact_addr']			= trim(request('contact_addr',''));
 		$data['contact_name']			= trim(request('contact_name',''));
 		$data['contact_shop']			= trim(request('contact_shop',''));
+		$data['shop_type']				= trim(request('shop_type',0));
 		$data['contact_phone']			= trim(request('contact_phone',''));
 		$data['is_default']				= request('is_default',0);
 		$data['custom_uid']				= $uid;
@@ -101,6 +102,7 @@ class CustomAddr extends Api{
 		$data['contact_addr']			= trim(request('contact_addr',''));
 		$data['contact_name']			= trim(request('contact_name',''));
 		$data['contact_shop']			= trim(request('contact_shop',''));
+		$data['shop_type']				= trim(request('shop_type',0));
 		$data['contact_phone']			= trim(request('contact_phone',''));
 		$data['is_default']				= request('is_default',0);
 		// 获取客户城市ID

+ 4 - 0
app/Http/Controllers/Api/CustomCoupon.php

@@ -76,6 +76,8 @@ class CustomCoupon extends Api{
 					}
 				}
 			}
+			// 排除范围
+			$productExclude				= [];
 			// 状态可用 且排除商品
 			if( $value['status'] == 0 && $value['type_id'] == 3 ) {
 				// 循环排除范围
@@ -146,6 +148,8 @@ class CustomCoupon extends Api{
 					}
 				}
 			}
+			// 排除范围
+			$productExclude				= [];
 			// 状态可用 且排除商品
 			if( $value['type_id'] == 3 ) {
 				// 循环排除范围

+ 35 - 4
app/Http/Controllers/Api/Orders.php

@@ -20,7 +20,6 @@ use App\Models\ShopCart;
 use Illuminate\Support\Facades\DB;
 use App\Models\WeiBan\Tags as WeiBanTags;
 use App\Models\PromoProduct as PromoProduct;
-use Monolog\Handler\IFTTTHandler;
 
 /**
  * 订单接口
@@ -57,7 +56,7 @@ class Orders extends Api{
 		// 如果不存在数据
 		if( !$addr )					return json_send(['code'=>'error','msg'=>'地址有误,请核对','data'=>['error'=>'没有找到对应的地址']]);
 		// 重组数据
-		$addr							= ['contact_name'=>$addr['contact_name'],'contact_shop'=>$addr['contact_shop'],'contact_phone'=>$addr['contact_phone'],'contact_province'=>$addr['contact_province'],'contact_city'=>$addr['contact_city'],'contact_area'=>$addr['contact_area'],'contact_addr'=>$addr['contact_addr']];
+		$addr							= ['contact_name'=>$addr['contact_name'],'contact_shop'=>$addr['contact_shop'],'shop_type'=>$addr['shop_type'],'contact_phone'=>$addr['contact_phone'],'contact_province'=>$addr['contact_province'],'contact_city'=>$addr['contact_city'],'contact_area'=>$addr['contact_area'],'contact_addr'=>$addr['contact_addr']];
 		// 获取客户城市ID
 		$custom							= $Custom->getOne($uid);
 		// 如果不存在的话
@@ -124,7 +123,7 @@ class Orders extends Api{
 				// 是否在限购时间,当前时间大于开始时间,并且小于结束时间
 				if( $productInfo['quota_start'] <= $time && $time <= $productInfo['quota_end'] ){
 					// 通过时间查询商品的购买总数
-					$total 				= $OrdersProduct->query()->where([['custom_uid','=',$uid],['product_id','=',$productInfo['id']],['insert_time','>=',$productInfo['quota_start']],['insert_time','<=',$productInfo['quota_end']]])->sum('buy_num');
+					$total 				= $OrdersProduct->query()->whereIn('status',[0,1,2,3,8,9])->where([['custom_uid','=',$uid],['is_rebate','=',0],['product_id','=',$productInfo['id']],['insert_time','>=',$productInfo['quota_start']],['insert_time','<=',$productInfo['quota_end']]])->sum('buy_num');
 					// 判断限购数量
 					$total	 			= $buyNum[$buyInfo['product_id']] + $total;
 					// 如果超过数量
@@ -137,11 +136,43 @@ class Orders extends Api{
 				if( empty($skusList[$buyInfo['product_skuid']]) ) return json_send(['code'=>'error','msg'=>'该产品规格不存在或已下架','data'=>['error'=>'SKU不存在或已下架=>'.$buyInfo['product_skuid']]]);
 				// 产品ID不匹配的话
 				if( $skusList[$buyInfo['product_skuid']]['product_id'] != $buyInfo['product_id'] ) return json_send(['code'=>'error','msg'=>'该产品规格不存在或已下架','data'=>['error'=>'SKU不匹配=>'.$buyInfo['product_skuid']]]);
+				// SKU信息
+				$skuInfo					= $skusList[$buyInfo['product_skuid']];
+				// 如果产品有最低起购
+				if( $skuInfo['min_quota'] )	{
+					// 如果购买数量小于最低起购数量
+					if( $buyInfo['buy_num'] < $skuInfo['min_quota'] ){
+						// 如果超过数量
+						return json_send(['code'=>'error','msg'=>'最少购买'.$skuInfo['min_quota'].'套-'.$productInfo['product_name'].'【'.$skuInfo['sku_attr_names'].'】','data'=>['error'=>'最少购买'.$skuInfo['min_quota'].'套-'.$productInfo['product_name']]]);
+					}
+				}
+				// 如果SKU限购
+				if( $skuInfo['quota'] )	{
+					// 是否在限购时间,当前时间大于开始时间,并且小于结束时间
+					if( $productInfo['quota_start'] <= $time && $time <= $productInfo['quota_end'] ){
+						// 通过时间查询商品的购买总数
+						$total 				= $OrdersProduct->query()->whereIn('status',[0,1,2,3,8,9])->where([['custom_uid','=',$uid],['is_rebate','=',0],['product_id','=',$productInfo['id']],['sku_attr_names','=',$skuInfo['sku_attr_names']],['insert_time','>=',$productInfo['quota_start']],['insert_time','<=',$productInfo['quota_end']]])->sum('buy_num');
+						// 判断限购数量
+						$total	 			= $buyInfo['buy_num'] + $total;
+						// 如果超过数量
+						if( $total > $skuInfo['quota'] ) return json_send(['code'=>'error','msg'=>'限购'.$skuInfo['quota'].'套-'.$productInfo['product_name'].'【'.$skuInfo['sku_attr_names'].'】','data'=>['error'=>'已超限=>'.($total - $skuInfo['quota'])]]);
+					}
+				}
+				// 删除起购字段,避免影响后续产品最低起购的判定
+				unset($skuInfo['min_quota']);
 				// 如果SKU存在,合并产品信息
-				$productInfo			= array_merge($productInfo,$skusList[$buyInfo['product_skuid']]);
+				$productInfo			= array_merge($productInfo,$skuInfo);
 				// 需要扣除的库存
 				$skusList[$buyInfo['product_skuid']]['decr'] = empty($skusList[$buyInfo['product_skuid']]['decr']) ? $buyInfo['buy_num'] : $skusList[$buyInfo['product_skuid']]['decr'] + $buyInfo['buy_num'];
 			}
+			// 如果产品有最低起购
+			if( $productInfo['min_quota'] )	{
+				// 如果购买数量小于最低起购数量
+				if( $buyNum[$buyInfo['product_id']] < $productInfo['min_quota'] ){
+					// 如果超过数量
+					return json_send(['code'=>'error','msg'=>'最少购买'.$productInfo['min_quota'].'套-'.$productInfo['product_name'],'data'=>['error'=>'最少购买'.$productInfo['min_quota'].'套-'.$productInfo['product_name']]]);
+				}
+			}
 			// 需要扣除的库存
 			$productList[$buyInfo['product_id']]['decr'] = empty($productList[$buyInfo['product_id']]['decr']) ? $buyInfo['buy_num'] : $productList[$buyInfo['product_id']]['decr'] + $buyInfo['buy_num'];
 			// 判断库存

+ 35 - 18
app/Http/Controllers/Api/Product.php

@@ -6,11 +6,9 @@ use App\Models\Business;
 use App\Models\Custom;
 use App\Models\Product as Model;
 use App\Models\Product\Attr as ProductAttr;
-use App\Models\Product\City as ProductCity;
 use App\Models\Product\Spec as ProductSpec;
 use App\Models\Product\Skus as ProductSkus;
 use App\Models\ProductPhoto;
-use App\Models\Promo;
 use App\Models\PromoProduct;
 use App\Models\PromoRebate;
 use App\Models\RegimentActive;
@@ -45,6 +43,7 @@ class Product extends Api{
 		// 接收参数
 		$name					    = request('name','');
 		$limit						= request('limit',10);
+        $cityId                     = empty($custom['city_id']) ? 0 : $custom['city_id'];
 		// 显示
 		$map						= [['status','=','0'],['stock','>',0]];
 		// 分类ID
@@ -59,7 +58,7 @@ class Product extends Api{
 										->groupBy('product_id')
 										->orderBy('product.sort')
 										->orderBy('product.id')
-										->paginate($limit,['product.id','product.sort','product.name','product.thumb','product.spec','product.price','product.market_price','product.stock']);
+										->paginate($limit,['product.id','product.sort','product.name','product.tag_scope','product.tag_exclude','product.thumb','product.spec','product.price','product.market_price','product.stock']);
 		// 获取数据
 		$data['total']				= $Paginator->total();
 		$data['current_page']		= $Paginator->currentPage();
@@ -75,25 +74,41 @@ class Product extends Api{
                                             ['promo.end_time','>=',$time],
                                             ['promo_product.status','=',0],
                                         ];
+        // 查询促销活动
         $promoList                  = PromoProduct::query()
-            ->join('promo','promo.id','=','promo_product.promo_id')
-            ->where($where)
-            ->whereIn('promo_product.product_id',$productIds)
-            ->select('promo.*','promo_product.product_id','promo_product.id as promo_product_id')
-            ->get()
-            ->toArray();
-        if ($promoList){
-            $promoList  =   array_column($promoList,NULL,'product_id');
-        }
+                                    ->join('promo','promo.id','=','promo_product.promo_id')
+                                    ->where($where)
+                                    ->whereIn('promo_product.product_id',$productIds)
+                                    ->select('promo.*','promo_product.product_id','promo_product.id as promo_product_id')
+                                    ->get()
+                                    ->toArray();
+        // 查询促销活动
+        if ($promoList)             $promoList = array_column($promoList,NULL,'product_id');
         // 查询用户标签
-        $tags                       =   [];
-        $cityId                     =   '';
-        if ($custom){
-            $tags					= $WeiBanTags->getListByWeibanExtid($custom['weiban_extid']);
-            $cityId					= $custom['city_id'];
-        }
+        $tags                       = $custom ? $WeiBanTags->getListByWeibanExtid($custom['weiban_extid']) : [];
+        $tagsList                   = array_column($tags,'name');
 		// 处理请求
 		foreach ( $data['data'] as $key => $value ) {
+            // 判断是不是可以参与
+			if( $value['tag_scope'] ) {
+				// 解析数组
+				$value['tag_scope']	= explode(',',$value['tag_scope']);
+				// 如果没有交集,不在参与范围内
+                if( !array_intersect($value['tag_scope'],$tagsList) ) {
+                    unset($data['data'][$key]);
+                    continue;
+                }
+			}
+			// 判断是不是可以参与
+			if( $value['tag_exclude'] ) {
+				// 解析数组
+				$value['tag_exclude']	= explode(',',$value['tag_exclude']);
+				// 如果有交集,在排除范围内
+                if( array_intersect($value['tag_exclude'],$tagsList) ) {
+                    unset($data['data'][$key]);
+                    continue;
+                }
+			}
 			// 处理数据
 			$value['thumb'] 				= path_compat($value['thumb']);
 			$value['regiment_active_id'] 	= null;
@@ -148,6 +163,8 @@ class Product extends Api{
 			// 重组数据
 			$data['data'][$key]		= $value;
 		}
+        // 数据重组
+        $data['data']               = array_values($data['data']);
 		// 返回结果
 		return						json_send(['code'=>'success','msg'=>'获取成功','data'=>$data]);
 	}

+ 1 - 1
app/Http/Controllers/Api/Score/Orders.php

@@ -42,7 +42,7 @@ class Orders extends Api{
 		// 如果不存在数据
 		if( !$addr )					return json_send(['code'=>'error','msg'=>'地址有误,请核对','data'=>['error'=>'没有找到对应的地址']]);
 		// 重组数据
-		$addr							= ['contact_name'=>$addr['contact_name'],'contact_shop'=>$addr['contact_shop'],'contact_phone'=>$addr['contact_phone'],'contact_province'=>$addr['contact_province'],'contact_city'=>$addr['contact_city'],'contact_area'=>$addr['contact_area'],'contact_addr'=>$addr['contact_addr']];
+		$addr							= ['contact_name'=>$addr['contact_name'],'contact_shop'=>$addr['contact_shop'],'shop_type'=>$addr['shop_type'],'contact_phone'=>$addr['contact_phone'],'contact_province'=>$addr['contact_province'],'contact_city'=>$addr['contact_city'],'contact_area'=>$addr['contact_area'],'contact_addr'=>$addr['contact_addr']];
 		// 解码
 		$productList					= $Product->getOne($productId);
 		// 如果产品不存在

+ 14 - 73
app/Http/Controllers/Api/Test.php

@@ -1,4 +1,6 @@
-<?php namespace App\Http\Controllers\Api;
+<?php
+
+namespace App\Http\Controllers\Api;
 
 use App\Http\Controllers\Api\Api;
 use App\Facades\Servers\WechatMini\Mini;
@@ -9,78 +11,17 @@ use App\Facades\Servers\WechatMini\Mini;
  * @author 刘相欣
  * 
  * */
-class Test extends Api{
-	
-	
-	/**
-	 * 同步			/api/test/sync_user
-	 * 
-	 * */
-	public function sync_user(){
-        // 跳转链接
-		$link						= Mini::getUrlLink('pages/index/index');
-		return 						json_send(['code'=>'error','msg'=>'禁用账号','data'=>$link]);
-    }
+class Test extends Api
+{
 
-	/**
-	 * 自动发放优惠券
-	 * 
-	 */
-	private function autoCoupon($uid){
-		// 模型实例
-		$Rule 					= new \App\Models\CouponRewardRule();
-		$RuleProduct 			= new \App\Models\CouponRewardProduct();
-		$OrdersProduct 			= new \App\Models\OrdersProduct();
-		$Custom					= new \App\Models\Custom();
-		$Coupon					= new \App\Models\Coupon();
-		$CustomCoupon			= new \App\Models\CustomCoupon();
-		// 获取配置列表
-		$ruleList				= $Rule->getList();
-		// 如果没有信息的话
-		if( !$ruleList )		return ['success'=>'暂无活动'];
-		// 获取客户城市ID
-		$customCityId			= (int) $Custom->getValue($uid,'city_id');
-		// 循环配置列表
-		foreach ( $ruleList as 	$value ) {
-			// 如果存在城市范围,并且不在城市范围,不参与这个活动
-			if( $value['city_ids'] && !in_array($customCityId,explode(',',$value['city_ids'])) ) continue;
-			// 未到开始时间
-			if( $value['start_time'] > time() )  continue;
-			// 通过配置ID获取对应的商品范围
-			$productList 		= $RuleProduct->getListByRule($value['id']);
-			// 如果不存在产品范围,跳过
-			if( !$productList ) continue;
-			// 获取客户 规定时段内订单的商品ID以及购买数量
-			$orderList 			= $OrdersProduct->query()->where([['custom_uid','=',$uid],['status','=',1],['insert_time','>=',$value['start_time']],['insert_time','<=',$value['end_time']]])->get(['product_id','buy_num'])->toArray();
-			// 如果没有订单总数
-			if( !$orderList ) 	continue;
-			// 计算商品总量
-			$total				= 0;
-			// 循环商品范围
-			foreach ($productList as $scope) {
-				// 循环订单产品
-				foreach ($orderList as $order) {
-					// 如果产品不相等
-					if( $scope['product_id'] != $order['product_id'] ) continue;
-					// 相等的计算总量
-					$total		+= $scope['product_units'] * $order['buy_num'];
-				}
-			}
-			// 判断总数是不是达标
-			if( $total < $value['std_num'] )  continue;
-			// 达标的是否已经发送过优惠券
-			$havaCoupon			= $CustomCoupon->query()->where([['custom_uid','=',$uid],['coupon_id','=',$value['coupon_id']]])->first(['status']);
-			// 已经发过优惠券的,不发
-			if( $havaCoupon )   continue;
-			// 获取优惠券的可用时间
-			$expTime			= $Coupon->query()->where([['id','=',$value['coupon_id']]])->value('exp_time');
-			// 时间转时间
-			$expTime			= $Coupon->getExpTime($expTime);
-			// 发送优惠券
-			$CustomCoupon->add(['coupon_id'=>$value['coupon_id'],'custom_uid'=>$uid,'exp_time'=>$expTime]);
-		}
-		// 返回成功
-		return					['success'=>'操作成功'];
-	}
 
+  /**
+   * 同步			/api/test/sync_user
+   * 
+   * */
+  public function sync_user(){
+    // 跳转链接
+    $link            = Mini::getUrlLink('pages/index/index');
+    return             json_send(['code' => 'error', 'msg' => '禁用账号', 'data' => $link]);
+  }
 }

+ 2 - 1
app/Http/Requests/Admin/Custom.php

@@ -16,7 +16,7 @@ class Custom extends BaseRequest
      */
     public function rules()
     {
-        // 编辑时排除ID 
+        // 编辑时排除ID
         $id			= request('uid',null);
         // 非重规则phone
 		$uniphone  	= Rule::unique('custom')->where(function ($query){
@@ -39,6 +39,7 @@ class Custom extends BaseRequest
 		'add'  		            => ['username','phone'],
         'edit'  		        => ['uid','username','phone'],
         'set_status'  		    => ['uid'],
+        'set_manager'  		    => ['uid'],
         'import_execl'          => ['custom_file'],
 	];
 

+ 5 - 0
app/Jobs/WeiBanSync.php

@@ -57,6 +57,8 @@ class WeiBanSync implements ShouldQueue
             $Sync   = new Sync();
             // 尝试执行
             try{
+                // 记录错误信息
+                Log::error('weiban_sync','进行更新',$this->extUser);
                 // 通过id查询详情信息
                 $extUser                        = OpenApi::getUserDetail($this->extUser['id']);
                 // 不存在客户信息,再次获取
@@ -65,6 +67,9 @@ class WeiBanSync implements ShouldQueue
                 if( $extUser )                  $this->sync_user($extUser);
                 // 解除锁定
                 $Sync->unlockSyncExtidMark($this->extUser['id']);
+                // 记录错误信息
+                Log::error('weiban_sync','更新成功',$this->extUser);
+
             } catch (\Exception $exception) {
                 // 解除锁定
                 $Sync->unlockSyncExtidMark($this->extUser['id']);

+ 2 - 2
app/Models/Custom.php

@@ -81,7 +81,7 @@ class Custom extends Model
     public function getOne($uid)
     {
         // 返回结果
-        $custom         = $this->query()->where([['uid','=',$uid]])->first(['uid','external_userid','weiban_extid','phone','userpic','username','sex','city_id','status','insert_time']);
+        $custom         = $this->query()->where([['uid','=',$uid]])->first(['uid','is_manager','external_userid','weiban_extid','phone','userpic','username','sex','city_id','status','insert_time']);
         // 返回结果
         if( !$custom )  return [];
         // 数据结构
@@ -98,7 +98,7 @@ class Custom extends Model
     public function getOneByPhone($phone)
     {
         // 返回结果
-        $custom         = $this->query()->where([['phone','=',$phone]])->first(['uid','external_userid','weiban_extid','phone','userpic','username','sex','city_id','status','insert_time']);
+        $custom         = $this->query()->where([['phone','=',$phone]])->first(['uid','is_manager','external_userid','weiban_extid','phone','userpic','username','sex','city_id','status','insert_time']);
         // 返回结果
         if( !$custom )  return [];
         // 数据结构

+ 105 - 0
app/Models/Custom/Shoptype.php

@@ -0,0 +1,105 @@
+<?php namespace App\Models\Custom;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+
+/**
+ * 客户地址模型
+ * 
+ */
+class Shoptype extends Model
+{
+    use HasFactory;
+
+    // 与模型关联的表名
+    protected $table = 'custom_shoptype';
+    // 是否主动维护时间戳
+    public $timestamps = false;
+    // 定义时间戳字段名
+    // const CREATED_AT = 'insert_time';
+    // const UPDATED_AT = 'update_time';
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function add($data)
+    {
+        // 时间
+        $data['insert_time']				= time();
+        $data['update_time']				= time();
+        // 写入数据表
+        $id						            = $this->query()->insertGetId($data);
+        // 如果操作失败
+        if( !$id )                          return $id;
+        // 更新缓存
+        $this->getList(true);
+        // 返回结果
+        return                              $id;
+    }
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function edit($id,$data)
+    {
+        // 更新时间
+        $data['update_time']                = time();
+        // 写入数据表
+        $result						        = $this->query()->where(['uid'=>$id])->update($data);
+        // 如果操作失败
+        if( !$result )                      return $result;
+        // 更新缓存
+        $this->getList(true);
+        // 返回结果
+        return                              $result;
+    }
+
+    /**
+     * 获取列表
+     * @param   Bool    $force  是否强制更新
+     * 
+     */
+    public function getList($force = false)
+    {
+        // 结果数据
+        $list                  = $force ? [] : cache('admin:custom:shoptype:list');
+        // 不存在数据
+        if ( !$list ) {
+            // 从数据库获取数据
+            $data              = $this->query()->where(['status'=>0])->get(['id','name']);
+            // 是否有数据
+            $data              = $data ? $data->toArray() : [];
+            // 循环处理数据
+            $list              = [];
+            // 进行更新
+            foreach ($data as $value) {
+                // 重组数据
+                $list[$value['id']] = $value;
+            }
+            // 存起来
+            cache(['admin:custom:shoptype:list'=>$list]);
+        }
+        // 返回结果
+        return                  $list;
+    }
+
+    /**
+     * 获取配置平台对应的应用数据
+     * 
+     * @param   int      用户ID
+     * @param   string     指定字段
+     * 
+     */
+    public function getOne($id,$field='')
+    {
+        // 获取列表数据
+        $list                   = $this->getList();
+        // 获取数据
+        $one                    = isset($list[$id]) ? $list[$id] : [];
+        // 返回值
+        return                  empty($field) ? $one : ( isset($one[$field]) ? $one[$field] : null);
+    }
+
+}

+ 2 - 2
app/Models/CustomAddr.php

@@ -66,7 +66,7 @@ class CustomAddr extends Model
      */
     public function getOne($id,$field=''){
         // 返回结果
-        $result     = $field ? $this->query()->where([['id','=',$id]])->value($field) : $this->query()->where([['id','=',$id]])->first(['id','custom_uid','contact_province','contact_city','contact_area','contact_addr','contact_name','contact_shop','contact_phone','is_default']);
+        $result     = $field ? $this->query()->where([['id','=',$id]])->value($field) : $this->query()->where([['id','=',$id]])->first(['id','custom_uid','contact_province','contact_city','contact_area','contact_addr','contact_name','contact_shop','contact_phone','is_default','shop_type']);
         // 返回结果
         return      $result;
     }
@@ -77,7 +77,7 @@ class CustomAddr extends Model
      */
     public function getListByCustom($uid){
         // 返回结果
-        $result     = $this->query()->where([['custom_uid','=',$uid]])->get(['id','custom_uid','contact_province','contact_city','contact_area','contact_addr','contact_name','contact_shop','contact_phone','is_default']);
+        $result     = $this->query()->where([['custom_uid','=',$uid]])->get(['id','custom_uid','contact_province','contact_city','contact_area','contact_addr','contact_name','contact_shop','contact_phone','is_default','shop_type']);
         // 返回结果
         return      $result;
     }

+ 1 - 1
app/Models/Product.php

@@ -160,7 +160,7 @@ class Product extends Model
     public function getListByIds($productIds)
     {
         // 写入数据表
-        $data				    = $this->query()->whereIn('id',$productIds)->where([['status','=',0]])->get(['id','name as product_name','thumb as product_thumb','spec as sku_attr_names','price','stock','status','business_id','quota','quota_start','quota_end','tag_scope','tag_exclude'])->toArray();
+        $data				    = $this->query()->whereIn('id',$productIds)->where([['status','=',0]])->get(['id','name as product_name','thumb as product_thumb','spec as sku_attr_names','price','stock','status','business_id','quota','min_quota','quota_start','quota_end','tag_scope','tag_exclude'])->toArray();
         // 列表
         $list                   = [];
         // 循环处理

+ 2 - 2
app/Models/Product/Skus.php

@@ -77,7 +77,7 @@ class Skus extends Model
     public function getListByIds($skuIds)
     {
         // 写入数据表
-        $data					= $this->query()->whereIn('id',$skuIds)->where([['status','=',0]])->get(['id as sku_id','product_id','attr_names as sku_attr_names','price','stock','status'])->toArray();
+        $data					= $this->query()->whereIn('id',$skuIds)->where([['status','=',0]])->get(['id as sku_id','product_id','attr_names as sku_attr_names','quota','min_quota','price','market_price','stock','status'])->toArray();
         // 列表
         $list                   = [];
         // 循环处理
@@ -97,7 +97,7 @@ class Skus extends Model
     public function getListByProductId($productId)
     {
         // 写入数据表
-        $list					= $this->query()->where([['product_id','=',$productId]])->get(['id','attr_ids','attr_names','sku_thumb','price','stock','status'])->toArray();
+        $list					= $this->query()->where([['product_id','=',$productId]])->get(['id','attr_ids','attr_names','min_quota','quota','sku_thumb','price','market_price','stock','status'])->toArray();
         // 返回结果
         return                  $list;
     }

+ 85 - 0
app/Models/WeiBan/Taglist.php

@@ -0,0 +1,85 @@
+<?php namespace App\Models\WeiBan;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+
+/**
+ * 客户-客服标签列表模型
+ * 
+ */
+class Taglist extends Model
+{
+    use HasFactory;
+
+    // 与模型关联的表名
+    protected $table = 'weiban_taglist';
+    // 是否主动维护时间戳
+    public $timestamps = false;
+    // 定义时间戳字段名
+    // const CREATED_AT = 'insert_time';
+    // const UPDATED_AT = 'update_time';
+    // 主键字段名
+    protected $primaryKey = 't_id';
+
+    /**
+     * 批量写入
+     * 
+     * @param   array      $list      数据列表
+     * 
+     */
+    function upsertData($list) {
+        // 数据处理
+        foreach ($list as $key => $value) {
+            $value      = ['t_id'=>$value['t_id'],'tag_id'=>$value['tag_id'],'tag_name'=>$value['tag_name'],'tag_group_id'=>$value['tag_group_id'],'tag_group_name'=>$value['tag_group_name']];
+            $list[$key] = $value;
+        }
+        // 批量写入
+        $result         = $this->query()->upsert($list,'t_id',['tag_id','tag_name','tag_group_id','tag_group_name']);
+        // 如果修改成功,更新获取标签列表缓存
+        if( $result )   $this->getList(true);
+        // 返回结果
+        return          $result;
+    }
+
+
+    /**
+     * 获取标签列表
+     * @param   Bool    $force  是否强制更新
+     * 
+     */
+    public function getList($force=false)
+    {
+        // 结果数据
+        $list                  = $force ? [] : cache('admin:weiban:taglist:list');
+        // 不存在数据
+        if ( !$list ) {
+            // 从数据库获取数据
+            $data              = $this->query()->get(['tag_id','tag_name','tag_group_id','tag_group_name']);
+            // 是否有数据
+            $data              = $data ? $data->toArray() : [];
+            // 循环处理数据
+            $list              = [];
+            // 进行更新
+            foreach ($data as $value) {
+                // 重组数据
+                $list[$value['tag_group_id']]['group_name']                  = $value['tag_group_name'];
+                $list[$value['tag_group_id']]['tag_list'][$value['tag_id']]  = $value['tag_name'];
+            }
+            // 存起来
+            cache(['admin:weiban:taglist:list'=>$list]);
+        }
+        // 返回结果
+        return                  $list;
+    }
+
+    /**
+     * 获取标签二维数组列表
+     * 
+     */
+    public function getListByItem()
+    {
+        // 获取标签数据
+        $tagList			= $this->query()->get(['tag_id','tag_name','tag_group_id','tag_group_name'])->toArray();
+        return              $tagList;
+    }
+}

+ 34 - 0
app/Servers/Aliyun/Client.php

@@ -0,0 +1,34 @@
+<?php namespace App\Servers\Aliyun;
+
+
+use AlibabaCloud\SDK\Dysmsapi\V20170525\Dysmsapi;
+use Darabonba\OpenApi\Models\Config;
+
+/**
+ * 阿里
+ *
+ * @author    刘相欣
+ */
+class Client{
+
+    /**
+     * 使用AK&SK初始化账号Client
+     * @return Dysmsapi Client
+     */
+    public static function createClient(){
+        // 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。
+        // 建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/311677.html。
+        $config = new Config([
+            // 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
+            "accessKeyId" => config('aliyun.accessKeyId',''),
+            // 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
+            "accessKeySecret" => config('aliyun.accessKeySecret',''),
+        ]);
+        // Endpoint 请参考 https://api.aliyun.com/product/Dysmsapi
+        $config->endpoint = "dysmsapi.aliyuncs.com";
+        // 返回结果
+        return              new Dysmsapi($config);
+    }
+
+}
+

+ 60 - 0
app/Servers/Aliyun/Sms.php

@@ -0,0 +1,60 @@
+<?php namespace App\Servers\Aliyun;
+
+
+use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\SendSmsRequest;
+use AlibabaCloud\Tea\Exception\TeaError;
+use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
+use AlibabaCloud\Tea\Utils\Utils;
+use App\Facades\Servers\Logs\Log;
+
+/**
+ * 验证码模型
+ *
+ * @author    刘相欣
+ */
+class Sms extends Client{
+
+
+    /**
+     * 发送短信
+     * @param string $phone 手机号。国际/港澳台消息需加国际区号。支持向不同的手机号码发送短信,手机号码之间以半角逗号(,)分隔。上限为 1000 个手机号码。批量发送相对于单条发送,及时性稍有延迟。验证码类型的短信,建议单条发送。
+     * @param string $signName 签名名称。
+     * @param string $templateCode 模板ID。
+     * @param array  $param 模板参数。短信模板变量对应的实际值。支持传入多个参数, json格式,如 {"name":"张三","number":"1390000****"}
+     * 
+     */
+    public function sendSms(string $phone,string $signName,string $templateCode,array $param=[]){
+        try {
+            // 变量参数转成json字符串
+            $param          = $param ? json_encode($param,JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE) : '';
+            $request        = ['phoneNumbers' => $phone,'signName' => $signName,'templateCode' => $templateCode];
+            if( $param )    $request['templateParam'] = $param;
+            // 创建请求
+            $sendSmsRequest = new SendSmsRequest($request);
+            // 创建终端
+            $client         = $this->createClient();
+            // 复制代码运行请自行打印 API 的返回值
+            $response       = $client->sendSmsWithOptions($sendSmsRequest, new RuntimeOptions([]))->toMap();
+            // 获取参数 
+            $result         = $response['body'];
+            // 如果失败的话
+            if( $result['Code'] != 'OK' )   return ['code'=>$result['Code'],'error'=>$result['Message'],'request_id'=>$result['RequestId']];
+            dd($result);
+            // 返回成功信息
+            return          ['code'=>$result['Code'],'message'=>$result['Message'],'requestId'=>$result['RequestId'],'bizId'=>$result['BizId']];
+        }catch (\Exception $error) {
+            // 返回错误信息
+            if ( !($error instanceof TeaError) ) {
+                $error = new TeaError([], $error->getMessage(), $error->getCode(), $error);
+            }
+            // 错误信息
+            $errorMsg          = Utils::assertAsString($error->message);
+            // 日志记录
+            Log::error('aliyun_sms',$errorMsg);
+            // 返回错误信息
+            return          ['error'=>$errorMsg];
+        }
+    }
+
+}
+

+ 20 - 0
app/Servers/WechatMini/Mini.php

@@ -82,5 +82,25 @@ class Mini
 		// 获取不包含区号的手机号(因为绑定手机号字段会有国际区号)
 		return                                  ['error'=>$result['errcode'].'=>'.$result['errmsg']];
     }
+
+    /**
+     * 获取小程序码
+     * 
+     * @param  string   $scene                  小程序码的场景值
+     * @param  array    $optional               其他参数
+     *                  page                    小程序码的页面路径
+     *                  width                   小程序码的宽度
+     * 
+     */
+    public function getUnlimit(string $scene, array $optional = []){
+        // // 版本
+        // $optional['env_version']                = 'production';//config('app.env','production') == 'production' ?  'release' : 'trial';
+        // 执行生成
+        $result                                 = $this->mp->app_code->getUnlimit($scene, $optional);
+        // 判断结果
+		if( $result instanceof \EasyWeChat\Kernel\Http\StreamResponse ) return $result->getBody()->getContents();
+		// 错误
+		return                                  ['error'=>$result['errcode'].'=>'.$result['errmsg']];
+    }
     
 }

+ 73 - 2
app/Servers/WeiBan/OpenApi.php

@@ -2,8 +2,7 @@
 
 use Ixudra\Curl\Facades\Curl;
 use App\Facades\Servers\Logs\Log;
-use App\Facades\Servers\Redis\Redis;
-use App\Facades\Servers\Redis\RedisLock;
+use App\Models\WeiBan\Taglist;
 
 /**
  * 微信小程序
@@ -164,6 +163,78 @@ class OpenApi
         return                              $result['external_user'];
     }
 
+    /**
+     * 获取标签列表
+     * 
+     * @param       int         $limit      每页条数
+     * @param       int         $offset     列表偏移。用于迭代获取所有数据,默认值为0
+     * 
+     * @return      array                   标签列表
+     * 
+     * */
+    public function getTagList($limit=100,$offset=0){
+        // 获取调用凭证
+        $accessToken                        = $this->getAccessToken();
+        // 如果没有返回
+        if( !$accessToken )                 return [];
+        // 组装接口
+        $url                                = $this->domain.'/open-api/tag/list';
+        // 调用接口
+        $result                             = Curl::to($url)->withData(['access_token'=>$accessToken,'limit'=>$limit,'offset'=>$offset])->asJson(true)->get();
+        // 如果没有返回
+        if( !isset($result['errcode']) )    {
+            Log::error('weiban_openai/tag_list','接口未返回数据');
+            return [];
+        }
+        // 如果是凭证错误,递归
+        if( $result['errcode'] == '10001' ) return $this->getTagList($limit,$offset);
+        // 如果调用结果失败
+        if( $result['errcode'] != 0 )       {
+            Log::error('weiban_openai/tag_list',$result['errcode'].'=>'.$result['errmsg']);
+            return                          [];
+        }
+        // 如果列表偏移量小于标签总数
+        if( $offset < $result['total'] )    {
+            // 休眠一秒钟,避免超限错误
+            sleep(1);
+            // 获取下一页
+            $result['tag_list']             = array_merge($result['tag_list'],$this->getTagList($limit,$offset+$limit));
+        }
+        // 修改数据
+        (new Taglist)->upsertData($result['tag_list']);
+        // 返回结果
+        return                              $result['tag_list'];
+    }
+
+    /**
+     * 批量更新客户企业标签
+     * 
+     * */ 
+    public function markTags($extUserid,$addTags,$rmTags,$staffId){
+        // 获取调用凭证
+        $accessToken                        = $this->getAccessToken();
+        // 如果没有返回
+        if( !$accessToken )                 return [];
+        // 组装接口
+        $url                                = $this->domain.'/open-api/tag/batch_update?access_token='.$accessToken;
+        $param                              = ['staff_id'=>$staffId,'external_user_id'=>$extUserid,'add_tag_id_list'=>$addTags,'remove_tag_id_list'=>$rmTags]; 
+        // 调用接口
+        $result                             = Curl::to($url)->withData($param)->asJson(true)->post();
+        // 如果没有返回
+        if( !isset($result['errcode']) )    {
+            Log::error('weiban_openai/tag_batch_update','接口未返回数据',$result);
+            return                          false;
+        }
+        // 如果是凭证错误,递归
+        if( $result['errcode'] == '10001' ) return $this->markTags($extUserid,$addTags,$rmTags,$staffId);
+        // 如果调用结果失败
+        if( $result['errcode'] != 0 )    {
+            Log::error('weiban_openai/tag_batch_update',$result['errcode'].'=>'.$result['errmsg']);
+            return                          false;
+        }
+        // 返回结果
+        return                              true;
+    }
 
 }
 

+ 1 - 0
composer.json

@@ -6,6 +6,7 @@
     "license": "MIT",
     "require": {
         "php": "^7.3|^8.0",
+        "alibabacloud/dysmsapi-20170525": "3.1.1",
         "fideloper/proxy": "^4.4",
         "firebase/php-jwt": "^6.10",
         "fruitcake/laravel-cors": "^2.0",

+ 553 - 1
composer.lock

@@ -4,8 +4,506 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "ed42257c340ab4839682e5b545073cf6",
+    "content-hash": "b0a46dcf3e2d7533be5df979f332f5ab",
     "packages": [
+        {
+            "name": "adbario/php-dot-notation",
+            "version": "2.5.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/adbario/php-dot-notation.git",
+                "reference": "081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/adbario/php-dot-notation/zipball/081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae",
+                "reference": "081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae",
+                "shasum": ""
+            },
+            "require": {
+                "ext-json": "*",
+                "php": "^5.5 || ^7.0 || ^8.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.8|^5.7|^6.6|^7.5|^8.5|^9.5",
+                "squizlabs/php_codesniffer": "^3.6"
+            },
+            "type": "library",
+            "autoload": {
+                "files": [
+                    "src/helpers.php"
+                ],
+                "psr-4": {
+                    "Adbar\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Riku Särkinen",
+                    "email": "riku@adbar.io"
+                }
+            ],
+            "description": "PHP dot notation access to arrays",
+            "homepage": "https://github.com/adbario/php-dot-notation",
+            "keywords": [
+                "ArrayAccess",
+                "dotnotation"
+            ],
+            "support": {
+                "issues": "https://github.com/adbario/php-dot-notation/issues",
+                "source": "https://github.com/adbario/php-dot-notation/tree/2.5.0"
+            },
+            "time": "2022-10-14T20:31:46+00:00"
+        },
+        {
+            "name": "alibabacloud/credentials",
+            "version": "1.2.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/aliyun/credentials-php.git",
+                "reference": "ebcda2e628180b4df235b46a86e1d014c561f5d9"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/aliyun/credentials-php/zipball/ebcda2e628180b4df235b46a86e1d014c561f5d9",
+                "reference": "ebcda2e628180b4df235b46a86e1d014c561f5d9",
+                "shasum": ""
+            },
+            "require": {
+                "adbario/php-dot-notation": "^2.2",
+                "alibabacloud/tea": "^3.0",
+                "ext-curl": "*",
+                "ext-json": "*",
+                "ext-libxml": "*",
+                "ext-mbstring": "*",
+                "ext-openssl": "*",
+                "ext-simplexml": "*",
+                "ext-xmlwriter": "*",
+                "guzzlehttp/guzzle": "^6.3|^7.0",
+                "php": ">=5.6"
+            },
+            "require-dev": {
+                "composer/composer": "^1.8",
+                "drupal/coder": "^8.3",
+                "ext-dom": "*",
+                "ext-pcre": "*",
+                "ext-sockets": "*",
+                "ext-spl": "*",
+                "mikey179/vfsstream": "^1.6",
+                "monolog/monolog": "^1.24",
+                "phpunit/phpunit": "^5.7|^6.6|^9.3",
+                "psr/cache": "^1.0",
+                "symfony/dotenv": "^3.4",
+                "symfony/var-dumper": "^3.4"
+            },
+            "suggest": {
+                "ext-sockets": "To use client-side monitoring"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\Credentials\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com",
+                    "homepage": "http://www.alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud Credentials for PHP",
+            "homepage": "https://www.alibabacloud.com/",
+            "keywords": [
+                "alibaba",
+                "alibabacloud",
+                "aliyun",
+                "client",
+                "cloud",
+                "credentials",
+                "library",
+                "sdk",
+                "tool"
+            ],
+            "support": {
+                "issues": "https://github.com/aliyun/credentials-php/issues",
+                "source": "https://github.com/aliyun/credentials-php"
+            },
+            "time": "2024-10-16T13:29:17+00:00"
+        },
+        {
+            "name": "alibabacloud/darabonba-openapi",
+            "version": "0.2.13",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/darabonba-openapi.git",
+                "reference": "0213396384e2c064eefd614f3dd53636a63f987f"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/darabonba-openapi/zipball/0213396384e2c064eefd614f3dd53636a63f987f",
+                "reference": "0213396384e2c064eefd614f3dd53636a63f987f",
+                "shasum": ""
+            },
+            "require": {
+                "alibabacloud/credentials": "^1.1",
+                "alibabacloud/gateway-spi": "^1",
+                "alibabacloud/openapi-util": "^0.1.10|^0.2.1",
+                "alibabacloud/tea-utils": "^0.2.21",
+                "alibabacloud/tea-xml": "^0.2",
+                "php": ">5.5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Darabonba\\OpenApi\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud OpenApi Client",
+            "support": {
+                "issues": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/issues",
+                "source": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/tree/0.2.13"
+            },
+            "time": "2024-07-15T13:11:36+00:00"
+        },
+        {
+            "name": "alibabacloud/dysmsapi-20170525",
+            "version": "3.1.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/Dysmsapi-20170525.git",
+                "reference": "5a301a076b29449a488607cbfbb7f12b8cc50c1f"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/Dysmsapi-20170525/zipball/5a301a076b29449a488607cbfbb7f12b8cc50c1f",
+                "reference": "5a301a076b29449a488607cbfbb7f12b8cc50c1f",
+                "shasum": ""
+            },
+            "require": {
+                "alibabacloud/darabonba-openapi": "^0.2.13",
+                "alibabacloud/endpoint-util": "^0.1.0",
+                "alibabacloud/openapi-util": "^0.1.10|^0.2.1",
+                "alibabacloud/tea-utils": "^0.2.21",
+                "php": ">5.5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\SDK\\Dysmsapi\\V20170525\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud Dysmsapi (20170525) SDK Library for PHP",
+            "support": {
+                "source": "https://github.com/alibabacloud-sdk-php/Dysmsapi-20170525/tree/3.1.1"
+            },
+            "time": "2025-01-03T17:14:56+00:00"
+        },
+        {
+            "name": "alibabacloud/endpoint-util",
+            "version": "0.1.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/endpoint-util.git",
+                "reference": "f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/endpoint-util/zipball/f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5",
+                "reference": "f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">5.5"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.8.35|^5.4.3"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\Endpoint\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud Endpoint Library for PHP",
+            "support": {
+                "source": "https://github.com/alibabacloud-sdk-php/endpoint-util/tree/0.1.1"
+            },
+            "time": "2020-06-04T10:57:15+00:00"
+        },
+        {
+            "name": "alibabacloud/gateway-spi",
+            "version": "1.0.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/alibabacloud-gateway-spi.git",
+                "reference": "7440f77750c329d8ab252db1d1d967314ccd1fcb"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/alibabacloud-gateway-spi/zipball/7440f77750c329d8ab252db1d1d967314ccd1fcb",
+                "reference": "7440f77750c329d8ab252db1d1d967314ccd1fcb",
+                "shasum": ""
+            },
+            "require": {
+                "alibabacloud/credentials": "^1.1",
+                "php": ">5.5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Darabonba\\GatewaySpi\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud Gateway SPI Client",
+            "support": {
+                "source": "https://github.com/alibabacloud-sdk-php/alibabacloud-gateway-spi/tree/1.0.0"
+            },
+            "time": "2022-07-14T05:31:35+00:00"
+        },
+        {
+            "name": "alibabacloud/openapi-util",
+            "version": "0.2.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/openapi-util.git",
+                "reference": "f31f7bcd835e08ca24b6b8ba33637eb4eceb093a"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/openapi-util/zipball/f31f7bcd835e08ca24b6b8ba33637eb4eceb093a",
+                "reference": "f31f7bcd835e08ca24b6b8ba33637eb4eceb093a",
+                "shasum": ""
+            },
+            "require": {
+                "alibabacloud/tea": "^3.1",
+                "alibabacloud/tea-utils": "^0.2",
+                "lizhichao/one-sm": "^1.5",
+                "php": ">5.5"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "*"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\OpenApiUtil\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud OpenApi Util",
+            "support": {
+                "issues": "https://github.com/alibabacloud-sdk-php/openapi-util/issues",
+                "source": "https://github.com/alibabacloud-sdk-php/openapi-util/tree/0.2.1"
+            },
+            "time": "2023-01-10T09:10:10+00:00"
+        },
+        {
+            "name": "alibabacloud/tea",
+            "version": "3.2.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/aliyun/tea-php.git",
+                "reference": "1619cb96c158384f72b873e1f85de8b299c9c367"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/aliyun/tea-php/zipball/1619cb96c158384f72b873e1f85de8b299c9c367",
+                "reference": "1619cb96c158384f72b873e1f85de8b299c9c367",
+                "shasum": ""
+            },
+            "require": {
+                "adbario/php-dot-notation": "^2.4",
+                "ext-curl": "*",
+                "ext-json": "*",
+                "ext-libxml": "*",
+                "ext-mbstring": "*",
+                "ext-openssl": "*",
+                "ext-simplexml": "*",
+                "ext-xmlwriter": "*",
+                "guzzlehttp/guzzle": "^6.3|^7.0",
+                "php": ">=5.5"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "*",
+                "symfony/dotenv": "^3.4",
+                "symfony/var-dumper": "^3.4"
+            },
+            "suggest": {
+                "ext-sockets": "To use client-side monitoring"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\Tea\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com",
+                    "homepage": "http://www.alibabacloud.com"
+                }
+            ],
+            "description": "Client of Tea for PHP",
+            "homepage": "https://www.alibabacloud.com/",
+            "keywords": [
+                "alibabacloud",
+                "client",
+                "cloud",
+                "tea"
+            ],
+            "support": {
+                "issues": "https://github.com/aliyun/tea-php/issues",
+                "source": "https://github.com/aliyun/tea-php"
+            },
+            "time": "2023-05-16T06:43:41+00:00"
+        },
+        {
+            "name": "alibabacloud/tea-utils",
+            "version": "0.2.21",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/tea-utils.git",
+                "reference": "5039e45714c6456186d267f5d81a4b260a652495"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-utils/zipball/5039e45714c6456186d267f5d81a4b260a652495",
+                "reference": "5039e45714c6456186d267f5d81a4b260a652495",
+                "shasum": ""
+            },
+            "require": {
+                "alibabacloud/tea": "^3.1",
+                "php": ">5.5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\Tea\\Utils\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud Tea Utils for PHP",
+            "support": {
+                "issues": "https://github.com/aliyun/tea-util/issues",
+                "source": "https://github.com/aliyun/tea-util"
+            },
+            "time": "2024-07-05T06:05:54+00:00"
+        },
+        {
+            "name": "alibabacloud/tea-xml",
+            "version": "0.2.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/alibabacloud-sdk-php/tea-xml.git",
+                "reference": "3e0c000bf536224eebbac913c371bef174c0a16a"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-xml/zipball/3e0c000bf536224eebbac913c371bef174c0a16a",
+                "reference": "3e0c000bf536224eebbac913c371bef174c0a16a",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">5.5"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "*",
+                "symfony/var-dumper": "*"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AlibabaCloud\\Tea\\XML\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Alibaba Cloud SDK",
+                    "email": "sdk-team@alibabacloud.com"
+                }
+            ],
+            "description": "Alibaba Cloud Tea XML Library for PHP",
+            "support": {
+                "source": "https://github.com/alibabacloud-sdk-php/tea-xml/tree/0.2.4"
+            },
+            "time": "2022-08-02T04:12:58+00:00"
+        },
         {
             "name": "asm89/stack-cors",
             "version": "v2.1.1",
@@ -2316,6 +2814,60 @@
             ],
             "time": "2023-08-05T12:09:49+00:00"
         },
+        {
+            "name": "lizhichao/one-sm",
+            "version": "1.10",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/lizhichao/sm.git",
+                "reference": "687a012a44a5bfd4d9143a0234e1060543be455a"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/lizhichao/sm/zipball/687a012a44a5bfd4d9143a0234e1060543be455a",
+                "reference": "687a012a44a5bfd4d9143a0234e1060543be455a",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.6"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "OneSm\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "tanszhe",
+                    "email": "1018595261@qq.com"
+                }
+            ],
+            "description": "国密sm3",
+            "keywords": [
+                "php",
+                "sm3"
+            ],
+            "support": {
+                "issues": "https://github.com/lizhichao/sm/issues",
+                "source": "https://github.com/lizhichao/sm/tree/1.10"
+            },
+            "funding": [
+                {
+                    "url": "https://www.vicsdf.com/img/w.jpg",
+                    "type": "custom"
+                },
+                {
+                    "url": "https://www.vicsdf.com/img/z.jpg",
+                    "type": "custom"
+                }
+            ],
+            "time": "2021-05-26T06:19:22+00:00"
+        },
         {
             "name": "maennchen/zipstream-php",
             "version": "2.2.6",

+ 6 - 0
config/aliyun.php

@@ -0,0 +1,6 @@
+<?php
+
+return [
+    'accessKeyId'       => 'LTAI5tDwjfteBvivYN41r8sJ', 
+    'accessKeySecret'   => 'yowuOGi2nYYnrqGpO3qcz94C4brcPp'
+];

+ 3 - 0
public/static/Admin/css/components.css

@@ -185,6 +185,9 @@ body {
     transform: scale(2.5);
   }
 }
+.form-group{
+  display: flex;
+}
 .form-group.form-md-line-input {
   position: relative;
   margin: 0 0 35px 0;

+ 1 - 1
resources/views/admin/banner/index.blade.php

@@ -7,7 +7,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	<a href="{{url('admin/banner/add')}}" class="btn btn-primary">新增</a>
 </div>
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入banner名称查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 4 - 4
resources/views/admin/business/add.blade.php

@@ -5,8 +5,8 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @section('content')
 <form class="post-form" action="" method="post">
 	<div class="form-group col-sm-12">
-		<label class="control-label">商店名称</label>
-		<input class="form-control" required="required" type="text" placeholder="店铺名称" name="name" maxlength="20" value="" />
+		<label class="control-label">商业公司</label>
+		<input class="form-control" required="required" type="text" placeholder="商业公司" name="name" maxlength="20" value="" />
 	</div>
 	<div class="form-group col-sm-2">
 		<label class="control-label">Logo图</label>
@@ -34,8 +34,8 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<input class="form-control" required="required" type="text" placeholder="简介说明" maxlength="255" name="address" value="" />
 	</div>
 	<div class="form-group col-sm-12">
-		<label class="control-label">店铺介绍</label>
-		<input class="form-control" required="required" type="text" placeholder="简介说明" maxlength="255" name="desc" value="" />
+		<label class="control-label">商业公司介绍</label>
+		<input class="form-control" required="required" type="text" placeholder="商业公司简介说明" maxlength="255" name="desc" value="" />
 	</div>
 	<div class="form-group col-sm-2">
 		<label class="control-label">上级代表</label>

+ 2 - 2
resources/views/admin/business/edit.blade.php

@@ -38,8 +38,8 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<input class="form-control" required="required" type="text" placeholder="简介说明" maxlength="255" name="address" value="{{$oldData['address']}}" />
 	</div>
 	<div class="form-group col-sm-12">
-		<label class="control-label">店铺介绍</label>
-		<input class="form-control" required="required" type="text" placeholder="简介说明" maxlength="255" name="desc" value="{{$oldData['desc']}}" />
+		<label class="control-label">商业公司介绍</label>
+		<input class="form-control" required="required" type="text" placeholder="商业公司简介说明" maxlength="255" name="desc" value="{{$oldData['desc']}}" />
 	</div>
 	<div class="form-group col-sm-2">
 		<label class="control-label">上级代表</label>

+ 7 - 7
resources/views/admin/business/index.blade.php

@@ -11,20 +11,20 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="business_code" value="{{request('business_code','')}}" placeholder="请输入商业公司编码查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="phone" value="{{request('phone','')}}" placeholder="请输入联系方式查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="status" class="form-control">
 			<option value="" >状态</option>
 			<option value="0" @if (request('status') === '0' ) selected="selected" @endif >正常</option>
 			<option value="1" @if (request('status') === '1' ) selected="selected" @endif >禁用</option>
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入创建时间查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
@@ -37,9 +37,9 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			<table class="table table-striped table-bordered table-hover">
 				<thead>
 					<tr>
-						<th>商店编码</th>
-						<th>商店状态</th>
-						<th>商店名称</th>
+						<th>编码</th>
+						<th>状态</th>
+						<th>商业公司</th>
 						<th>联系方式</th>
 						<th>城市</th>
 						<th>详细地址</th>

+ 4 - 4
resources/views/admin/contact_way/index.blade.php

@@ -11,10 +11,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="remark" value="{{request('remark','')}}" placeholder="请输入活码名称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="user" class="form-control selectpicker" require="" data-live-search="true" data-live-search-placeholder="搜索人员" data-none-results-text="未搜索到 {0}" title="接待人员" >
 			@foreach ($partUserList as $part)
 			<optgroup label="{{$part['name']}}">
@@ -25,7 +25,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="custom_uid" class="form-control selectpicker" require="" data-live-search="true" data-live-search-placeholder="搜索人员" data-none-results-text="未搜索到 {0}" title="使用对象" >
 			@foreach ($customList as $group)
 			<optgroup label="{{$group['user_group']}}">
@@ -36,7 +36,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="is_follow" class="form-control" require="" >
 			<option value="0" > 推送客服 </option>
 			<option value="1" > 是 </option>

+ 18 - 0
resources/views/admin/coupon_active/get_poster.blade.php

@@ -0,0 +1,18 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-12">
+		<label class="control-label">活动名称</label>
+		<input class="form-control" required="required" disabled="" type="text" placeholder="活动名称" name="name" maxlength="45" value="{{$oldData['name']}}" />
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">活动海报</label>
+		<div class="form-group col-sm-12">
+			<img src="{{$image}}" alt="{{$oldData['name']}}" height="300" title="{{$oldData['name']}}">
+		</div>
+	</div>
+</form>
+@endsection

+ 4 - 1
resources/views/admin/coupon_active/index.blade.php

@@ -11,7 +11,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入活动名称查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
@@ -70,6 +70,9 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 								@if(check_auth('admin/coupon_active/edit'))
 								<a href="{{url('admin/coupon_active/edit?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-warning" >编辑</a>
 								@endif
+								@if(check_auth('admin/coupon_active/get_poster'))
+								<a href="{{url('admin/coupon_active/get_poster?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-success" >海报</a>
+								@endif
 								@if(check_auth('admin/coupon_active/set_status'))
 									@if($a['status'])
 									<a data-url="{{url('admin/coupon_active/set_status?'.http_build_query(['id'=>$a['id'],'status'=>0]))}}" class="set_status btn btn-sm btn-success" >启用</a>

+ 2 - 2
resources/views/admin/coupon_active_coupon/index.blade.php

@@ -10,7 +10,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	</div>
 @endif
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="active_id" required="required" class="form-control" >
 			<option value="0" > 选择活动 </option>
 			@foreach ($activeList as $value)
@@ -18,7 +18,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="coupon_code" value="{{request('coupon_code','')}}" placeholder="请输入优惠券编码查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 2 - 2
resources/views/admin/coupon_product/index.blade.php

@@ -11,10 +11,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="coupon_code" value="{{request('coupon_code','')}}" placeholder="请输入优惠券编码查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="product_code" value="{{request('product_code','')}}" placeholder="请输入产品编码查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 2 - 2
resources/views/admin/coupon_product_exclude/index.blade.php

@@ -11,10 +11,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="coupon_code" value="{{request('coupon_code','')}}" placeholder="请输入优惠券编码查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="product_code" value="{{request('product_code','')}}" placeholder="请输入产品编码查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 2 - 2
resources/views/admin/coupon_reward_product/index.blade.php

@@ -11,7 +11,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="reward_rule_id" required="required" class="form-control" >
 			<option value="0" > 选择配置 </option>
 			@foreach ($ruleList as $value)
@@ -19,7 +19,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="product_code" value="{{request('product_code','')}}" placeholder="请输入产品编码查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 1 - 1
resources/views/admin/coupon_reward_rule/index.blade.php

@@ -11,7 +11,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入配置名称查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 13 - 6
resources/views/admin/custom/index.blade.php

@@ -20,23 +20,23 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 </div>
 @endif
 <form action="" method="get" name="thisform" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="custom_code" value="{{request('custom_code','')}}" placeholder="请输入客户编码查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="phone" value="{{request('phone','')}}" placeholder="请输入联系方式查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="weiban_extid" value="{{request('weiban_extid','')}}" placeholder="请输入微伴ID查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="status" class="form-control">
 			<option value="" >客户状态</option>
 			<option value="0" @if (request('status') === '0' ) selected="selected" @endif >正常</option>
 			<option value="1" @if (request('status') === '1' ) selected="selected" @endif >禁用</option>
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 	<select name="city_id" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市">
 			@foreach ($cityList as $group)
 			<optgroup label="{{$group['name']}}">
@@ -47,7 +47,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入创建时间查询" />
 	</div>
 	<div class="form-group col col-xs-4 col-md-2" style="margin-right: 2px;">
@@ -107,6 +107,13 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 									<a data-url="{{url('admin/custom/set_status?'.http_build_query(['uid'=>$a['uid'],'status'=>1]))}}" class="set_status btn btn-sm btn-danger" >拉黑</a>
 									@endif
 								@endif
+								@if(check_auth('admin/custom/set_manager'))
+									@if( $a['is_manager'] )
+									<a data-url="{{url('admin/custom/set_manager?'.http_build_query(['uid'=>$a['uid'],'is_manager'=>0]))}}" class="set_status btn btn-sm btn-danger" >取消内部账号</a>
+									@else
+									<a data-url="{{url('admin/custom/set_manager?'.http_build_query(['uid'=>$a['uid'],'is_manager'=>1]))}}" class="set_status btn btn-sm btn-success" >设置内部账号</a>
+									@endif
+								@endif
 							</td>							
 						</tr>  
 						@endforeach

+ 5 - 5
resources/views/admin/custom_clockin_record/index.blade.php

@@ -4,13 +4,13 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endsection
 @section('content')
 <form action="" method="get" class="form-horizontal form-line" name="thisform">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="active_name" value="{{request('active_name','')}}" placeholder="请输入活动名称" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="custom_code" value="{{request('custom_code','')}}" placeholder="请输入客户编码查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="phone" value="{{request('phone','')}}" placeholder="请输入联系方式查询" />
 	</div>
 	<div class="form-group col col-lg-1 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
@@ -24,10 +24,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入创建时间查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="end_time" value="{{request('end_time','')}}" placeholder="请输入结束查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 2 - 2
resources/views/admin/custom_company/index.blade.php

@@ -9,10 +9,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="custom_code" value="{{request('custom_code','')}}"  maxlength="13" placeholder="请输入客户编码查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="status" class="form-control">
 			<option value="0" @if (request('status',0) == '0' ) selected="selected" @endif >待审核</option>
 			<option value="4" @if (request('status',0) == '4' ) selected="selected" @endif >已拒绝</option>

+ 18 - 0
resources/views/admin/lottery_order/get_poster.blade.php

@@ -0,0 +1,18 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-12">
+		<label class="control-label">活动名称</label>
+		<input class="form-control" required="required" disabled="" type="text" placeholder="活动名称" name="name" maxlength="45" value="{{$oldData['name']}}" />
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">活动海报</label>
+		<div class="form-group col-sm-12">
+			<img src="{{$image}}" alt="{{$oldData['name']}}" height="300" title="{{$oldData['name']}}">
+		</div>
+	</div>
+</form>
+@endsection

+ 4 - 1
resources/views/admin/lottery_order/index.blade.php

@@ -11,7 +11,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入活动名称查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
@@ -81,6 +81,9 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 									<a data-url="{{url('admin/lottery_order/set_status?'.http_build_query(['id'=>$a['id'],'status'=>1]))}}" class="set_status btn btn-sm btn-danger" >停用</a>
 									@endif
 								@endif
+								@if(check_auth('admin/lottery_order/get_poster'))
+								<a href="{{url('admin/lottery_order/get_poster?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-success" >海报</a>
+								@endif
 							</td>							
 						</tr>  
 						@endforeach

+ 2 - 2
resources/views/admin/lottery_order_product/index.blade.php

@@ -11,7 +11,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="lottery_id" required="required" class="form-control" >
 			<option value="0" > 选择活动 </option>
 			@foreach ($lotteryList as $value)
@@ -19,7 +19,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="product_code" value="{{request('product_code','')}}" placeholder="请输入产品编码查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 4 - 4
resources/views/admin/lottery_order_record/index.blade.php

@@ -5,7 +5,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @section('content')
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="lottery_id" required="required" class="form-control" >
 			<option value="0" > 选择活动 </option>
 			@foreach ($lotteryList as $value)
@@ -13,7 +13,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="status" required="required" class="form-control" >
 			<option value="0" > 状态 </option>
 			@foreach ($statusList as $value)
@@ -21,10 +21,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入奖品名称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="custom_code" value="{{request('custom_code','')}}" placeholder="请输入客户编码查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 2 - 2
resources/views/admin/lottery_order_reward/index.blade.php

@@ -10,7 +10,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	</div>
 @endif
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="lottery_id" required="required" class="form-control" >
 			<option value="0" > 选择活动 </option>
 			@foreach ($lotteryList as $value)
@@ -18,7 +18,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入奖品名称查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 1 - 1
resources/views/admin/lottery_score/index.blade.php

@@ -11,7 +11,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入活动名称查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 4 - 4
resources/views/admin/lottery_score_record/index.blade.php

@@ -5,7 +5,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @section('content')
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="lottery_id" required="required" class="form-control" >
 			<option value="0" > 选择活动 </option>
 			@foreach ($lotteryList as $value)
@@ -13,7 +13,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="status" required="required" class="form-control" >
 			<option value="0" > 状态 </option>
 			@foreach ($statusList as $value)
@@ -21,10 +21,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入奖品名称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="custom_code" value="{{request('custom_code','')}}" placeholder="请输入客户编码查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 2 - 2
resources/views/admin/lottery_score_reward/index.blade.php

@@ -10,7 +10,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	</div>
 @endif
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="lottery_id" required="required" class="form-control" >
 			<option value="0" > 选择活动 </option>
 			@foreach ($lotteryList as $value)
@@ -18,7 +18,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入奖品名称查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 3 - 3
resources/views/admin/orders/index.blade.php

@@ -42,7 +42,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	</div>
 	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
 		<select name="business_id" class="form-control">
-			<option value="" >店铺</option>
+			<option value="" >商业公司</option>
 			@foreach ($businessList as $business)
 				<option value="{{$business['id']}}" @if (request('business_id') === $business['id'] ) selected="selected" @endif >{{$business['name']}}</option>
 			@endforeach
@@ -95,7 +95,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>订单编号</th>
 						<th>产品编码</th>
 						<th>下单用户</th>
-						<th>店铺</th>
+						<th>商业公司</th>
 						<th>产品名称</th>
 						<th>产品规格</th>
 						<th>产品数量</th>
@@ -124,7 +124,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<td>¥{{$a['pay_total']}}</td>
 						<td>{{$a['contact_name']}}</td>
 						<td>{{$a['contact_phone']}}</td>
-						<td>{{$a['contact_province']}}/{{$a['contact_city']}}/{{$a['contact_area']}}/{{$a['contact_addr']}} {{$a['contact_shop']}}</td>
+						<td>{{$a['contact_province']}}/{{$a['contact_city']}}/{{$a['contact_area']}}/{{$a['contact_addr']}} {{$a['contact_shop']}} {{$a['shop_type']}}</td>
 						<td>{{$a['state']}}</td>
 						<td>{{date('Y-m-d H:i:s',$a['insert_time'])}}</td>
 						<td>{{$a['regiment_id']>0?'是':'否'}}</td>

+ 1 - 1
resources/views/admin/orders_banner/index.blade.php

@@ -7,7 +7,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	<a href="{{url('admin/orders_banner/add')}}" class="btn btn-primary">新增</a>
 </div>
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入banner名称查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 1 - 1
resources/views/admin/orders_receipt/index.blade.php

@@ -7,7 +7,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	<a href="{{url('admin/orders_banner/add')}}" class="btn btn-primary">新增</a>
 </div>
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入banner名称查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 4 - 4
resources/views/admin/orders_transport/index.blade.php

@@ -7,16 +7,16 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	<a href="{{url('admin/orders_transport/add')}}" class="btn btn-primary">新增</a>
 </div>
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="order_code" value="{{request('order_code','')}}" placeholder="请输入订单编码查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入开始时间查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="end_time" value="{{request('end_time','')}}" placeholder="请输入结束时间查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="admin_name" value="{{request('admin_name','')}}" placeholder="出库人员名称" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 3 - 3
resources/views/admin/producer/index.blade.php

@@ -11,17 +11,17 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入厂家名称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="status" class="form-control">
 			<option value="" >状态</option>
 			<option value="0" @if (request('status') === '0' ) selected="selected" @endif >正常</option>
 			<option value="1" @if (request('status') === '1' ) selected="selected" @endif >禁用</option>
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入创建时间查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 12 - 8
resources/views/admin/product/add.blade.php

@@ -98,6 +98,18 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<label class="control-label">下架时间</label>
 		<input class="form-control" type="datetime-local" placeholder="下架时间" name="putoff_time" value="" />
 	</div>
+	<div class="form-group col-sm-2">
+		<label class="control-label">最低起购</label>
+		<input class="form-control" required="required" type="number" placeholder="最低起购数量,设置为0表示不限制"  name="min_quota" value="0" />
+	</div>
+	<div class="form-group col-sm-2">
+		<label class="control-label">商品类型</label>
+		<select name="type_id" class="form-control" id="typeId">
+			@foreach ($typeList as $value)
+				<option value="{{$value['id']}}"  >{{$value['name']}}</option>
+			@endforeach
+		</select>
+	</div>
 	<div class="form-group col-sm-2">
 		<label class="control-label">服务城市</label>
 		<select name="city_ids[]" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市" multiple>
@@ -110,14 +122,6 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col-sm-2">
-		<label class="control-label">商品类型</label>
-		<select name="type_id" class="form-control" id="typeId">
-			@foreach ($typeList as $value)
-				<option value="{{$value['id']}}"  >{{$value['name']}}</option>
-			@endforeach
-		</select>
-	</div>
 	<div class="form-group col-sm-2">
 		<label class="control-label">生产厂家</label>
 		<select name="producer_id" class="form-control selectpicker"  data-live-search="true" data-live-search-placeholder="搜索生产厂家" data-none-results-text="未搜索到 {0}" title="选择厂家">

+ 29 - 19
resources/views/admin/product/copy.blade.php

@@ -98,6 +98,18 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<label class="control-label">下架时间</label>
 		<input class="form-control" type="datetime-local" placeholder="下架时间" name="putoff_time" value="{{$oldData['putoff_time']?date('Y-m-d H:i',$oldData['putoff_time']):''}}" />
 	</div>
+	<div class="form-group col-sm-2">
+		<label class="control-label">最低起购</label>
+		<input class="form-control" required="required" type="number" placeholder="最低起购数量,设置为0表示不限制"  name="min_quota" value="{{$oldData['min_quota']}}" />
+	</div>
+	<div class="form-group col-sm-2">
+		<label class="control-label">商品类型</label>
+		<select name="type_id" class="form-control" id="typeId">
+			@foreach ($typeList as $value)
+				<option value="{{$value['id']}}"  >{{$value['name']}}</option>
+			@endforeach
+		</select>
+	</div>
 	<div class="form-group col-sm-2">
 		<label class="control-label">服务城市</label>
 		<select name="city_ids[]" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市" multiple>
@@ -110,14 +122,6 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col-sm-2">
-		<label class="control-label">商品类型</label>
-		<select name="type_id" class="form-control" id="typeId">
-			@foreach ($typeList as $value)
-				<option value="{{$value['id']}}"  >{{$value['name']}}</option>
-			@endforeach
-		</select>
-	</div>
 	<div class="form-group col-sm-2">
 		<label class="control-label">生产厂家</label>
 		<select name="producer_id" required class="form-control selectpicker"  data-live-search="true" data-live-search-placeholder="搜索生产厂家" data-none-results-text="未搜索到 {0}" title="选择厂家">
@@ -164,18 +168,18 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			<label class="control-label">{{$spec['name']}}</label>
 			<div class="form-group col-sm-12">
 				@if( empty($spec['attr_list']))
-				<div class="form-group col-sm-3 attr_div">
+				<div class="form-group col-lg-6 col-md-6 col-sm-12 col-xs-12 attr_div">
 					<div class="form-group form-inline">
-						<div class="input-group col-sm-4">
+						<div class="input-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
 							<!-- @if ($spec['has_img'])
 							<span class="input-group-addon btn-primary" data-toggle="image" style="cursor:pointer;" title="上传图片">
 								<i class="fa fa-file-photo-o"></i>
 								<input type="hidden" name="attr[{{$spec['id']}}][thumb][]" placeholder="图片路径">
 							</span>
 							@endif -->
-							<input type="{{$spec['input_type']}}" name="attr[{{$spec['id']}}][name][]" class="form-control attr_name" maxlength="20" required="required" placeholder="属性" />
+							<input type="{{$spec['input_type']}}" name="attr[{{$spec['id']}}][name][]" class="form-control attr_name" maxlength="40" required="required" placeholder="属性" />
 						</div>
-						<div class="input-group col-sm-4">
+						<div class="input-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
 							<input type="text" class="form-control" name="attr[{{$spec['id']}}][remark][]" maxlength="20" placeholder="备注" />
 							<span class="input-group-addon btn-danger remove_attr" style="cursor:pointer;">
 								<i class="fa fa-trash-o"></i>
@@ -185,18 +189,18 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 				</div>
 				@else
 					@foreach ($spec['attr_list'] as $attr)
-					<div class="form-group col-sm-3 attr_div">
+					<div class="form-group col-lg-6 col-md-6 col-sm-12 col-xs-12 attr_div">
 						<div class="form-group form-inline">
-							<div class="input-group col-sm-4">
+							<div class="input-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
 								<!-- @if ($spec['has_img'])
 								<span class="input-group-addon btn-primary" data-toggle="image" style="cursor:pointer;" title="上传图片">
 									<i class="fa fa-file-photo-o"></i>
 									<input type="hidden" name="attr[{{$spec['id']}}][thumb][]" placeholder="图片路径" vlalue="value="{{$attr['thumb']}}" ">
 								</span>
 								@endif -->
-								<input type="{{$spec['input_type']}}" name="attr[{{$spec['id']}}][name][]" class="form-control attr_name" maxlength="20" required="required" placeholder="属性" value="{{$attr['name']}}" />
+								<input type="{{$spec['input_type']}}" name="attr[{{$spec['id']}}][name][]" class="form-control attr_name" maxlength="40" required="required" placeholder="属性" value="{{$attr['name']}}" />
 							</div>
-							<div class="input-group col-sm-4">
+							<div class="input-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
 								<input type="text" class="form-control" name="attr[{{$spec['id']}}][remark][]" maxlength="20" placeholder="备注" value="{{$attr['remark']}}" />
 								<span class="input-group-addon btn-danger remove_attr" style="cursor:pointer;">
 									<i class="fa fa-trash-o"></i>
@@ -206,7 +210,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 					</div>
 					@endforeach
 				@endif
-				<div class="form-group col-sm-3 add_attr_div">
+				<div class="form-group col-lg-6 col-md-6 col-sm-12 col-xs-12 add_attr_div">
 					<div class="form-group form-inline">
 						<div class="input-group">
 							<button type="button"  class="form-control add_attr"><i class="ace-icon fa glyphicon-plus"></i>添加属性</button>
@@ -237,8 +241,11 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							<th>{{$value['name']}}</th>
 							@endforeach
 							<th>配图</th>
-							<th>价格</th>
+							<th>原价</th>
+							<th>折扣价</th>
 							<th>库存</th>
+							<th>起购数量</th>
+							<th>限购数量</th>
 							<th>是否上架</th>
 							<th>操作</th>
 						</tr>
@@ -257,8 +264,11 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 									<input type="hidden" name="sku[{{$value['attr_ids']}}][sku_thumb]" laceholder="缩略图" value="{{$value['sku_thumb']??''}}" id="input-sku_thumb{{$key}}" />
 								</div>
 							</td>
-							<td><input type="text" name="sku[{{$value['attr_ids']}}][price]" placeholder="价格" value="{{$value['price']}}"></td>
+							<td><input type="text" name="sku[{{$value['attr_ids']}}][market_price]" placeholder="原价" value="{{$value['market_price']}}"></td>
+							<td><input type="text" name="sku[{{$value['attr_ids']}}][price]" placeholder="折扣价" value="{{$value['price']}}"></td>
 							<td><input type="number" name="sku[{{$value['attr_ids']}}][stock]" placeholder="库存"  value="{{$value['stock']}}"></td>
+							<td><input type="number" name="sku[{{$value['attr_ids']}}][min_quota]" placeholder="起购数量" value="{{$value['min_quota']}}"></td>
+							<td><input type="number" name="sku[{{$value['attr_ids']}}][quota]" placeholder="限购数量" value="{{$value['quota']}}"></td>
 							<td>
 								<select name="sku[{{$value['attr_ids']}}][status]" >
 									<option value="0" @if( $value['status'] == 0 )  selected @endif>上架</option>

+ 30 - 20
resources/views/admin/product/edit.blade.php

@@ -98,6 +98,18 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<label class="control-label">下架时间</label>
 		<input class="form-control" type="datetime-local" placeholder="下架时间" name="putoff_time" value="{{$oldData['putoff_time']?date('Y-m-d H:i',$oldData['putoff_time']):''}}" />
 	</div>
+	<div class="form-group col-sm-2">
+		<label class="control-label">最低起购</label>
+		<input class="form-control" required="required" type="number" placeholder="最低起购数量,设置为0表示不限制"  name="min_quota" value="{{$oldData['min_quota']}}" />
+	</div>
+	<div class="form-group col-sm-2">
+		<label class="control-label">商品类型</label>
+		<select name="type_id" class="form-control" id="typeId">
+			@foreach ($typeList as $value)
+				<option value="{{$value['id']}}"  >{{$value['name']}}</option>
+			@endforeach
+		</select>
+	</div>
 	<div class="form-group col-sm-2">
 		<label class="control-label">服务城市</label>
 		<select name="city_ids[]" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市" multiple>
@@ -110,14 +122,6 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
-	<div class="form-group col-sm-2">
-		<label class="control-label">商品类型</label>
-		<select name="type_id" class="form-control" id="typeId">
-			@foreach ($typeList as $value)
-				<option value="{{$value['id']}}"  >{{$value['name']}}</option>
-			@endforeach
-		</select>
-	</div>
 	<div class="form-group col-sm-2">
 		<label class="control-label">生产厂家</label>
 		<select name="producer_id" required class="form-control selectpicker"  data-live-search="true" data-live-search-placeholder="搜索生产厂家" data-none-results-text="未搜索到 {0}" title="选择厂家">
@@ -164,18 +168,18 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			<label class="control-label">{{$spec['name']}}</label>
 			<div class="form-group col-sm-12">
 				@if( empty($spec['attr_list']))
-				<div class="form-group col-sm-3 attr_div">
+				<div class="form-group attr_div col-lg-6 col-md-6 col-sm-12 col-xs-12">
 					<div class="form-group form-inline">
-						<div class="input-group col-sm-4">
+						<div class="input-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
 							<!-- @if ($spec['has_img'])
 							<span class="input-group-addon btn-primary" data-toggle="image" style="cursor:pointer;" title="上传图片">
 								<i class="fa fa-file-photo-o"></i>
 								<input type="hidden" name="attr[{{$spec['id']}}][thumb][]" placeholder="图片路径">
 							</span>
 							@endif -->
-							<input type="{{$spec['input_type']}}" name="attr[{{$spec['id']}}][name][]" class="form-control attr_name" maxlength="20" required="required" placeholder="属性" />
+							<input type="{{$spec['input_type']}}" name="attr[{{$spec['id']}}][name][]" class="form-control attr_name" maxlength="40" required="required" placeholder="属性" />
 						</div>
-						<div class="input-group col-sm-4">
+						<div class="input-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
 							<input type="text" class="form-control" name="attr[{{$spec['id']}}][remark][]" maxlength="20" placeholder="备注" />
 							<span class="input-group-addon btn-danger remove_attr" style="cursor:pointer;">
 								<i class="fa fa-trash-o"></i>
@@ -185,18 +189,18 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 				</div>
 				@else
 					@foreach ($spec['attr_list'] as $attr)
-					<div class="form-group col-sm-3 attr_div">
+					<div class="form-group attr_div col-lg-6 col-md-6 col-sm-12 col-xs-12">
 						<div class="form-group form-inline">
-							<div class="input-group col-sm-4">
+							<div class="input-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
 								<!-- @if ($spec['has_img'])
 								<span class="input-group-addon btn-primary" data-toggle="image" style="cursor:pointer;" title="上传图片">
 									<i class="fa fa-file-photo-o"></i>
 									<input type="hidden" name="attr[{{$spec['id']}}][thumb][]" placeholder="图片路径" vlalue="value="{{$attr['thumb']}}" ">
 								</span>
 								@endif -->
-								<input type="{{$spec['input_type']}}" name="attr[{{$spec['id']}}][name][]" class="form-control attr_name" maxlength="20" required="required" placeholder="属性" value="{{$attr['name']}}" />
+								<input type="{{$spec['input_type']}}" name="attr[{{$spec['id']}}][name][]" class="form-control attr_name" maxlength="40" required="required" placeholder="属性" value="{{$attr['name']}}" />
 							</div>
-							<div class="input-group col-sm-4">
+							<div class="input-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
 								<input type="text" class="form-control" name="attr[{{$spec['id']}}][remark][]" maxlength="20" placeholder="备注" value="{{$attr['remark']}}" />
 								<span class="input-group-addon btn-danger remove_attr" style="cursor:pointer;">
 									<i class="fa fa-trash-o"></i>
@@ -206,7 +210,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 					</div>
 					@endforeach
 				@endif
-				<div class="form-group col-sm-3 add_attr_div">
+				<div class="form-group add_attr_div col-lg-6 col-md-6 col-sm-12 col-xs-12">
 					<div class="form-group form-inline">
 						<div class="input-group">
 							<button type="button"  class="form-control add_attr"><i class="ace-icon fa glyphicon-plus"></i>添加属性</button>
@@ -237,8 +241,11 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							<th>{{$value['name']}}</th>
 							@endforeach
 							<th>配图</th>
-							<th>价格</th>
+							<th>原价</th>
+							<th>折扣价</th>
 							<th>库存</th>
+							<th>起购数量</th>
+							<th>限购数量</th>
 							<th>是否上架</th>
 							<th>操作</th>
 						</tr>
@@ -257,8 +264,11 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 									<input type="hidden" name="sku[{{$value['attr_ids']}}][sku_thumb]" laceholder="缩略图" value="{{$value['sku_thumb']??''}}" id="input-sku_thumb{{$key}}" />
 								</div>
 							</td>
-							<td><input type="text" name="sku[{{$value['attr_ids']}}][price]" placeholder="价格" value="{{$value['price']}}"></td>
+							<td><input type="text" name="sku[{{$value['attr_ids']}}][market_price]" placeholder="原价" value="{{$value['market_price']}}"></td>
+							<td><input type="text" name="sku[{{$value['attr_ids']}}][price]" placeholder="折扣价" value="{{$value['price']}}"></td>
 							<td><input type="number" name="sku[{{$value['attr_ids']}}][stock]" placeholder="库存"  value="{{$value['stock']}}"></td>
+							<td><input type="number" name="sku[{{$value['attr_ids']}}][min_quota]" placeholder="起购数量" value="{{$value['min_quota']}}"></td>
+							<td><input type="number" name="sku[{{$value['attr_ids']}}][quota]" placeholder="限购数量" value="{{$value['quota']}}"></td>
 							<td>
 								<select name="sku[{{$value['attr_ids']}}][status]" >
 									<option value="0" @if( $value['status'] == 0 )  selected @endif>上架</option>
@@ -294,7 +304,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	<div class="form-group col-sm-12">
 		@csrf
 		<input type="hidden" name="id" value="{{$oldData['id']}}" />
-		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
+		<input id="send" type="submit" @if( !$oldData['status'] ) disabled="" value="上架产品 仅查看" @else value="提交" @endif  class="btn btn-primary btn-block" />
 	</div>
 </form>
 @endsection

+ 22 - 0
resources/views/admin/product/get_poster.blade.php

@@ -0,0 +1,22 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-12">
+		<label class="control-label">产品名称</label>
+		<input class="form-control" required="required" disabled="" type="text" placeholder="产品名称" value="{{$oldData['name']}}" />
+	</div>
+	<!-- <div class="form-group col-sm-12">
+		<label class="control-label">宣发链接 (注意该链接有效期仅30天)</label>
+		<input class="form-control" required="required" disabled="" type="text" placeholder="宣发链接" value="{{$urlLink}}" />
+	</div> -->
+	<div class="form-group col-sm-12">
+		<label class="control-label">产品海报</label>
+		<div class="form-group col-sm-12">
+			<img src="{{$image}}" alt="{{$oldData['name']}}" height="300" title="{{$oldData['name']}}">
+		</div>
+	</div>
+</form>
+@endsection

+ 8 - 2
resources/views/admin/product/get_sku_html.blade.php

@@ -7,8 +7,11 @@
 					<th>{{$value['spec_name']}}</th>
 					@endforeach
 					<th>配图</th>
-					<th>价格</th>
+					<th>原价</th>
+					<th>折扣价</th>
 					<th>库存</th>
+					<th>起购数量</th>
+					<th>限购数量</th>
 					<th>是否上架</th>
 					<th>操作</th>
 				</tr>
@@ -27,8 +30,11 @@
 							<input type="hidden" name="sku[{{$value['attr_names']}}][sku_thumb]" laceholder="缩略图" value="{{$value['sku_thumb']??''}}" id="input-sku_thumb{{$key}}" />
 						</div>
 					</td>
-					<td><input type="text" name="sku[{{$value['attr_names']}}][price]" placeholder="价格" value="{{$value['price']}}"></td>
+					<td><input type="text" name="sku[{{$value['attr_names']}}][market_price]" placeholder="原价" value="{{$value['market_price']}}"></td>
+					<td><input type="text" name="sku[{{$value['attr_names']}}][price]" placeholder="折扣价" value="{{$value['price']}}"></td>
 					<td><input type="number" name="sku[{{$value['attr_names']}}][stock]" placeholder="库存" value="{{$value['stock']}}"></td>
+					<td><input type="number" name="sku[{{$value['attr_names']}}][min_quota]" placeholder="起购数量" value="{{$value['min_quota']}}"></td>
+					<td><input type="number" name="sku[{{$value['attr_names']}}][quota]" placeholder="限购数量" value="{{$value['quota']}}"></td>
 					<td>
 						<select name="sku[{{$value['attr_names']}}][status]" >
 							<option value="0" @if( $value['status'] == 0) selected @endif >上架</option>

+ 9 - 9
resources/views/admin/product/get_spec_html.blade.php

@@ -4,18 +4,18 @@
 	<label class="control-label">{{$spec['name']}}</label>
 	<div class="form-group col-sm-12">
 		@if( empty($spec['attr_list']))
-		<div class="form-group col-sm-3 attr_div">
+		<div class="form-group attr_div col-lg-6 col-md-6 col-sm-12 col-xs-12">
 			<div class="form-group form-inline">
-				<div class="input-group col-sm-4">
+				<div class="input-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
 					<!-- @if ($spec['has_img'])
 					<span class="input-group-addon btn-primary" data-toggle="image" style="cursor:pointer;" title="上传图片">
 						<i class="fa fa-file-photo-o"></i>
 						<input type="hidden" name="attr[{{$spec['id']}}][thumb][]" placeholder="图片路径">
 					</span>
 					@endif -->
-					<input type="{{$spec['input_type']}}" name="attr[{{$spec['id']}}][name][]" class="form-control attr_name" maxlength="20" required="required" placeholder="属性" />
+					<input type="{{$spec['input_type']}}" name="attr[{{$spec['id']}}][name][]" class="form-control attr_name" maxlength="40" required="required" placeholder="属性" />
 				</div>
-				<div class="input-group col-sm-4">
+				<div class="input-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
 					<input type="text" class="form-control" name="attr[{{$spec['id']}}][remark][]" maxlength="20" placeholder="备注" />
 					<span class="input-group-addon btn-danger remove_attr" style="cursor:pointer;">
 						<i class="fa fa-trash-o"></i>
@@ -25,18 +25,18 @@
 		</div>
 		@else
 			@foreach ($spec['attr_list'] as $attr)
-			<div class="form-group col-sm-3 attr_div">
+			<div class="form-group attr_div col-lg-6 col-md-6 col-sm-12 col-xs-12">
 				<div class="form-group form-inline">
-					<div class="input-group col-sm-4">
+					<div class="input-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
 						<!-- @if ($spec['has_img'])
 						<span class="input-group-addon btn-primary" data-toggle="image" style="cursor:pointer;" title="上传图片">
 							<i class="fa fa-file-photo-o"></i>
 							<input type="hidden" name="attr[{{$spec['id']}}][thumb][]" placeholder="图片路径" vlalue="value="{{$attr['thumb']}}" ">
 						</span>
 						@endif -->
-						<input type="{{$spec['input_type']}}" name="attr[{{$spec['id']}}][name][]" class="form-control attr_name" maxlength="20" required="required" placeholder="属性" value="{{$attr['name']}}" />
+						<input type="{{$spec['input_type']}}" name="attr[{{$spec['id']}}][name][]" class="form-control attr_name" maxlength="40" required="required" placeholder="属性" value="{{$attr['name']}}" />
 					</div>
-					<div class="input-group col-sm-4">
+					<div class="input-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
 						<input type="text" class="form-control" name="attr[{{$spec['id']}}][remark][]" maxlength="20" placeholder="备注" value="{{$attr['remark']}}" />
 						<span class="input-group-addon btn-danger remove_attr" style="cursor:pointer;">
 							<i class="fa fa-trash-o"></i>
@@ -46,7 +46,7 @@
 			</div>
 			@endforeach
 		@endif
-		<div class="form-group col-sm-3 add_attr_div">
+		<div class="form-group add_attr_div col-lg-6 col-md-6 col-sm-12 col-xs-12">
 			<div class="form-group form-inline">
 				<div class="input-group">
 					<button type="button"  class="form-control add_attr"><i class="ace-icon fa glyphicon-plus"></i>添加属性</button>

+ 37 - 6
resources/views/admin/product/index.blade.php

@@ -35,7 +35,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	</div>
 	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
 		<select name="business_id" class="form-control">
-			<option value="" >店铺</option>
+			<option value="" >商业公司</option>
 			@foreach ($businessList as $business)
 			<option value="{{$business['id']}}" @if (request('business_id') === $business['id'] ) selected="selected" @endif >{{$business['name']}}</option>
 			@endforeach
@@ -60,11 +60,11 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>剩余库存</th>
 						<th>产品销量</th>
 						<th>产品库存</th>
-						<th>产品状态</th>
 						<th>服务城市</th>
-						<th>店铺</th>
+						<th>商业公司</th>
 						<th>排序</th>
 						<th>限购数量</th>
+						<th>产品状态</th>
 						<th>修改时间</th>
 						<th>操作</th>
 					</tr>
@@ -79,7 +79,6 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<td>{{$a['stock']}}</td>
 						<td>{{$a['sales_total']}}</td>
 						<td>{{$a['stock_total']}}</td>
-						<td> {{$a['status']?'已下架':'已上架'}} </td>
 						<td> {{$a['city_name']}}</td>
 						<td> {{$a['business_name']}}</td>
 						<td>
@@ -90,11 +89,33 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							@endif
 						</td>
 						<td> {{$a['quota']}} </td>
+						<td> 
+							@switch($a['status'])
+								@case(1)
+									编辑中
+								@break
+								@case(0)
+									已上架
+								@break
+								@case(2)
+									预上架
+								@break
+								@case(3)
+									已中止
+								@break
+								@case(4)
+									已结束
+								@break
+								@default
+									无
+								@break
+							@endswitch
+						</td>
 						<td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
 						<td>
 							@if(check_auth('admin/product/edit'))
 							<a class="btn btn-sm btn-warning" href="{{url('admin/product/edit?'.http_build_query(['id'=>$a['id']]))}}" title="查看">
-								编辑
+								@if ($a['status']) 编辑 @else 查看 @endif
 							</a>
 							@endif
 							@if(check_auth('admin/product/copy'))
@@ -104,15 +125,25 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							@endif
 							@if(check_auth('admin/product/set_status'))
 								@if ($a['status'])
+									<!-- 判断是不是有上架时间 -->
+									@if ( $a['puton_time'] )
+									<a class="delete btn btn-sm btn-success" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'2']))}}">
+										预上架
+									</a>
+									@else
 									<a class="delete btn btn-sm btn-success" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
 										上架
 									</a>
+									@endif
 								@else
-									<a class="delete btn btn-sm btn-danger" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'1']))}}">
+									<a class="delete btn btn-sm btn-danger" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'3']))}}">
 										下架
 									</a>
 								@endif
 							@endif
+							@if(check_auth('admin/product/get_poster'))
+							<a href="{{url('admin/product/get_poster?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-success" >海报</a>
+							@endif
 						</td>
 					</tr>
 					@endforeach

+ 2 - 2
resources/views/admin/product_spec/index.blade.php

@@ -11,10 +11,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入类型名称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="type_id" class="form-control">
 			<option value="" >选择类型</option>
 			@foreach ($typeList as $value)

+ 1 - 1
resources/views/admin/product_type/index.blade.php

@@ -11,7 +11,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入类型名称查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 2 - 2
resources/views/admin/promo_product/index.blade.php

@@ -11,10 +11,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="promo_code" value="{{request('promo_code','')}}" placeholder="请输入促销活动编码查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="product_code" value="{{request('product_code','')}}" placeholder="请输入产品编码查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 18 - 0
resources/views/admin/recruitment_active/get_poster.blade.php

@@ -0,0 +1,18 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-12">
+		<label class="control-label">活动名称</label>
+		<input class="form-control" required="required" disabled="" type="text" placeholder="活动名称" name="name" maxlength="45" value="{{$oldData['name']}}" />
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">活动海报</label>
+		<div class="form-group col-sm-12">
+			<img src="{{$image}}" alt="{{$oldData['name']}}" height="300" title="{{$oldData['name']}}">
+		</div>
+	</div>
+</form>
+@endsection

+ 7 - 4
resources/views/admin/recruitment_active/index.blade.php

@@ -11,10 +11,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入活动名称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="id_code" value="{{request('id_code','')}}" placeholder="请输入活动编码查询" />
 	</div>
 	<div class="form-group col col-md-1" style="margin-right: 2px;">
@@ -25,10 +25,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			<option value="3" @if (request('status') === '3' ) selected="selected" @endif >结束</option>
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入创建时间查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="end_time" value="{{request('end_time','')}}" placeholder="请输入结束查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
@@ -96,6 +96,9 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 									<a data-url="{{url('admin/recruitment_active/set_status?'.http_build_query(['id'=>$a['id'],'status'=>1]))}}" class="set_status btn btn-sm btn-danger" >停用</a>
 									@endif
 								@endif
+								@if(check_auth('admin/recruitment_active/get_poster'))
+									<a href="{{url('admin/recruitment_active/get_poster?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-success" >海报</a>
+								@endif
 							</td>							
 						</tr>  
 						@endforeach

+ 5 - 5
resources/views/admin/recruitment_record/index.blade.php

@@ -5,19 +5,19 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @section('content')
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="code" value="{{request('code','')}}" placeholder="请输入活动编码查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="old_uid_code" value="{{request('old_uid_code','')}}" placeholder="请输入客户编码查询(老)" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="new_uid_code" value="{{request('new_uid_code','')}}" placeholder="请输入客户编码查询(新)" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入创建时间查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="end_time" value="{{request('end_time','')}}" placeholder="请输入结束查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 6 - 6
resources/views/admin/regiment/index.blade.php

@@ -5,13 +5,13 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @section('content')
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="code" value="{{request('code','')}}" placeholder="请输入活动编码" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入活动名称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="product_name" value="{{request('product_name','')}}" placeholder="请输入产品名称查询" />
 	</div>
 	<div class="form-group col col-md-1" style="margin-right: 2px;">
@@ -23,10 +23,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			<option value="3" @if (request('status') === '3' ) selected="selected" @endif >拼团失败</option>
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入创建时间查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="end_time" value="{{request('end_time','')}}" placeholder="请输入结束查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
@@ -43,7 +43,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>参与活动/活动编码</th>
 						<th>产品名称/产品编码</th>
 						<th>发起客户昵称/发起客户编码</th>
-						<th>店铺</th>
+						<th>商业公司</th>
 						<th>拼团状态</th>
 						<th>开始时间</th>
 						<th>结束时间</th>

+ 1 - 1
resources/views/admin/regiment_active/add.blade.php

@@ -80,7 +80,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		</div>
 	</div>
 	<div class="form-group col-sm-6">
-		<label class="control-label">店铺</label>
+		<label class="control-label">商业公司</label>
 		<select name="business_id" class="form-control selectpicker" data-live-search="true" data-live-search-placeholder="搜索商业公司" data-none-results-text="未搜索到 {0}" title="选择商业公司">
 			@foreach ($businessList as $value)
 				<option value="{{$value['id']}}" selected >{{$value['name']}}</option>

+ 1 - 1
resources/views/admin/regiment_active/edit.blade.php

@@ -80,7 +80,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			</div>
 		</div>
 		<div class="form-group col-sm-6">
-			<label class="control-label">店铺</label>
+			<label class="control-label">商业公司</label>
 			<select name="business_id" required class="form-control selectpicker" data-live-search="true" data-live-search-placeholder="搜索商业公司" data-none-results-text="未搜索到 {0}" title="选择商业公司">
 				@foreach ($businessList as $value)
 					<option value="{{$value['id']}}" @if( $value['id'] == $oldData['business_id']) selected @endif >{{$value['name']}}</option>

+ 6 - 6
resources/views/admin/regiment_active/index.blade.php

@@ -11,13 +11,13 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="code" value="{{request('code','')}}" placeholder="请输入活动编码" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入活动名称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="product_name" value="{{request('product_name','')}}" placeholder="请输入产品名称查询" />
 	</div>
 	<div class="form-group col col-md-1" style="margin-right: 2px;">
@@ -28,10 +28,10 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			<option value="3" @if (request('status') === '3' ) selected="selected" @endif >结束</option>
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入创建时间查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="end_time" value="{{request('end_time','')}}" placeholder="请输入结束查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
@@ -50,7 +50,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>拼团人数(人)</th>
 						<th>活动价格(元)</th>
 						<th>拼团有效期</th>
-						<th>店铺</th>
+						<th>商业公司</th>
 						<th>状态</th>
 						<th>活动时间</th>
 						<th>创建时间</th>

+ 6 - 6
resources/views/admin/regiment_record/index.blade.php

@@ -5,19 +5,19 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @section('content')
 
 <form action="" method="get" class="form-horizontal form-line" name="thisform">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="code" value="{{request('code','')}}" placeholder="请输入活动编码" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入活动名称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="product_name" value="{{request('product_name','')}}" placeholder="请输入产品名称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入创建时间查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="end_time" value="{{request('end_time','')}}" placeholder="请输入结束查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
@@ -40,7 +40,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>参与活动/活动编码</th>
 						<th>产品名称/产品编码</th>
 						<th>发起客户昵称/发起客户编码</th>
-						<th>店铺</th>
+						<th>商业公司</th>
 						<th>拼团状态</th>
 						<th>订单生成时间</th>
 					</tr>

+ 18 - 0
resources/views/admin/score_clockin_active/get_poster.blade.php

@@ -0,0 +1,18 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-12">
+		<label class="control-label">活动名称</label>
+		<input class="form-control" required="required" disabled="" type="text" placeholder="活动名称" name="name" maxlength="45" value="{{$oldData['name']}}" />
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">活动海报</label>
+		<div class="form-group col-sm-12">
+			<img src="{{$image}}" alt="{{$oldData['name']}}" height="300" title="{{$oldData['name']}}">
+		</div>
+	</div>
+</form>
+@endsection

+ 7 - 4
resources/views/admin/score_clockin_active/index.blade.php

@@ -11,7 +11,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @endif
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入活动名称查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
@@ -47,7 +47,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							<td>{{$a['tag_scope']}}</td>
 							<td>{{date('Y/m/d H:i:s',$a['start_time'])}}</td>
 							<td>{{date('Y/m/d H:i:s',$a['end_time'])}}</td>
-							<td>/pages/coupon/active?id={{$a['id']}}</td>
+							<td>/pages/score/clockin?id={{$a['id']}}</td>
 							<td>{{$a['mp_urllink']}}</td>
 							<td>
 								@if( $a['status'] )
@@ -69,11 +69,14 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 								@if(check_auth('admin/score_clockin/index'))
 								<a href="{{url('admin/score_clockin/index?'.http_build_query(['active_id'=>$a['id']]))}}" class="btn btn-sm btn-primary" >打卡配置</a>
 								@endif
+								@if(check_auth('admin/score_clockin_active/copy'))
+									<a data-url="{{url('admin/score_clockin_active/copy?'.http_build_query(['id'=>$a['id'],'status'=>0]))}}" class="set_status btn btn-sm btn-success" >复制</a>
+								@endif
 								@if(check_auth('admin/score_clockin_active/edit'))
 								<a href="{{url('admin/score_clockin_active/edit?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-warning" >编辑</a>
 								@endif
-								@if(check_auth('admin/score_clockin_active/copy'))
-									<a data-url="{{url('admin/score_clockin_active/copy?'.http_build_query(['id'=>$a['id'],'status'=>0]))}}" class="set_status btn btn-sm btn-success" >复制</a>
+								@if(check_auth('admin/score_clockin_active/get_poster'))
+									<a href="{{url('admin/score_clockin_active/get_poster?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-success" >海报</a>
 								@endif
 								@if(check_auth('admin/score_clockin_active/set_status'))
 									@if($a['status'])

+ 4 - 4
resources/views/admin/score_product/index.blade.php

@@ -7,20 +7,20 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	<a href="{{url('admin/score_product/add')}}" class="btn btn-primary">新增</a>
 </div>
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="product_code" value="{{request('product_code','')}}" placeholder="请输入产品编码查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入产品名称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="status" class="form-control">
 			<option value="" >产品状态</option>
 			<option value="0" @if (request('status') === '0' ) selected="selected" @endif >已上架</option>
 			<option value="1" @if (request('status') === '1' ) selected="selected" @endif >已下架</option>
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入创建时间查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 5 - 5
resources/views/admin/stock/index.blade.php

@@ -7,23 +7,23 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	<a href="{{url('admin/stock/add')}}" class="btn btn-primary">新增</a>
 </div>
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="product_code" value="{{request('product_code','')}}" placeholder="请输入产品编码查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="product_name" value="{{request('product_name','')}}" placeholder="请输入产品名称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<select name="status" class="form-control">
 			<option value="" >产品状态</option>
 			<option value="0" @if (request('status') === '0' ) selected="selected" @endif >已上架</option>
 			<option value="1" @if (request('status') === '1' ) selected="selected" @endif >已下架</option>
 		</select>
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入开始时间查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="end_time" value="{{request('end_time','')}}" placeholder="请输入结束时间查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 12 - 6
resources/views/admin/weiban_external/index.blade.php

@@ -5,19 +5,19 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @section('content')
 
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="id" value="{{request('id','')}}" placeholder="请输入微伴ID查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入客户昵称查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="phone" value="{{request('phone','')}}" placeholder="请输入客户手机查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="remark" value="{{request('remark','')}}" placeholder="请输入客户备注查询" />
 	</div>
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="date" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入创建时间查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
@@ -59,7 +59,13 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							<td> <a href="{{url('admin/custom/index?'.http_build_query(['custom_code'=>$a['custom_code']]))}}">{{$a['custom_name']}}</a></td>
 							<td> {{date('Y/m/d H:i:s',$a['insert_time'])}}</td>
 							<td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
-							<td> </td>
+							<td>
+								@if(check_auth('admin/weiban_external/mark_tags'))
+								<a class="btn btn-success btn-sm" href="{{url('admin/weiban_external/mark_tags?'.http_build_query(['weiban_extid'=>$a['id'],'staff_id'=>$a['staff_id']]))}}">
+									客户标签
+								</a>
+								@endif
+							</td>
 						</tr>  
 						@endforeach
 						<tr>

+ 39 - 0
resources/views/admin/weiban_external/mark_tags.blade.php

@@ -0,0 +1,39 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-4">
+		<label class="control-label">客户昵称</label>
+		<input class="form-control" disabled="" type="text" placeholder="名称" maxlength="50" name="name" value="{{$oldData['name']}}" />
+	</div>
+	<div class="form-group col-sm-4">
+		<label class="control-label">客户备注</label>
+		<input class="form-control" disabled=""  type="text" placeholder="名称" maxlength="50" name="name" value="{{$oldData['remark']}}" />
+	</div>
+	<div class="form-group col-sm-4" >
+		<label class="control-label">接待人员</label>
+		<select name="userid" class="form-control" disabled="" >
+			<option value="{{$oldData['staff_id']}}" >{{$oldData['staff_name']}}</option>
+		</select>
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">客户标签</label>
+		<select name="tags[]" class="form-control selectpicker" data-live-search="true" data-live-search-placeholder="搜索标签" data-none-results-text="未搜索到 {0}" title="选择标签" multiple>
+			@foreach ($tagList as $group)
+			<optgroup label="{{$group['group_name']}}">
+				@foreach ($group['tag_list'] as $tagid=>$tagname)
+				<option value="{{$tagname}}"  @if(in_array($tagname,$oldData['tags'])) selected @endif >{{$tagname}}</option>
+				@endforeach
+			</optgroup>
+			@endforeach
+		</select>
+	</div>
+	<div class="form-group col-sm-12">
+		@csrf
+		
+		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
+	</div>
+</form>
+@endsection

+ 1 - 1
resources/views/admin/weiban_qrcode/index.blade.php

@@ -7,7 +7,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	<a href="{{url('admin/weiban_qrcode/add')}}" class="btn btn-primary">新增</a>
 </div>
 <form action="" method="get" class="form-horizontal form-line">
-	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
 		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入名称查询" />
 	</div>
 	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>

+ 1 - 0
routes/api.php

@@ -21,6 +21,7 @@ Route::any('wechat/phone_number',[\App\Http\Controllers\Api\Wechat::class,'phone
 
 // 客户信息
 Route::any('custom/get_info',[\App\Http\Controllers\Api\Custom::class,'get_info']);
+Route::any('custom/get_city',[\App\Http\Controllers\Api\Custom::class,'get_city']);
 
 // 资质信息
 Route::any('custom_company/get_info',[\App\Http\Controllers\Api\CustomCompany::class,'get_info']);

+ 18 - 4
routes/web.php

@@ -1,6 +1,5 @@
 <?php
 
-use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Route;
 
 /*
@@ -114,6 +113,8 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     // 状态
     Route::any('product/set_status',[App\Http\Controllers\Admin\Product::class,'set_status']);
     // 状态
+    Route::any('product/get_poster',[App\Http\Controllers\Admin\Product::class,'get_poster']);
+    // 状态
     Route::any('product/get_spec_html',[App\Http\Controllers\Admin\Product::class,'get_spec_html']);
     // 状态
     Route::any('product/get_sku_html',[App\Http\Controllers\Admin\Product::class,'get_sku_html']);
@@ -130,6 +131,8 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     Route::any('custom/edit',[App\Http\Controllers\Admin\Custom::class,'edit']);
     // 状态
     Route::any('custom/set_status',[App\Http\Controllers\Admin\Custom::class,'set_status']);
+    // 状态
+    Route::any('custom/set_manager',[App\Http\Controllers\Admin\Custom::class,'set_manager']);
     // 订单导入
     Route::any('custom/import_execl',[App\Http\Controllers\Admin\Custom::class,'import_execl']);
     // 订单导入
@@ -252,6 +255,8 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     Route::any('coupon_active/edit',[App\Http\Controllers\Admin\CouponActive::class,'edit']);
     // 状态
     Route::any('coupon_active/set_status',[App\Http\Controllers\Admin\CouponActive::class,'set_status']);
+    // 状态
+    Route::any('coupon_active/get_poster',[App\Http\Controllers\Admin\CouponActive::class,'get_poster']);
 
     /* 优惠券活动 */
     // 列表
@@ -338,6 +343,8 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     /* 微伴客户 */
     // 列表
     Route::any('weiban_external/index',[App\Http\Controllers\Admin\WeibanExternal::class,'index']);
+    // 列表
+    Route::any('weiban_external/mark_tags',[App\Http\Controllers\Admin\WeibanExternal::class,'mark_tags']);
 
     /* 订单Banner */
     // 列表
@@ -406,6 +413,8 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     Route::any('lottery_order/edit',[App\Http\Controllers\Admin\LotteryOrder::class,'edit']);
     // 状态
     Route::any('lottery_order/set_status',[App\Http\Controllers\Admin\LotteryOrder::class,'set_status']);
+    // 状态
+    Route::any('lottery_order/get_poster',[App\Http\Controllers\Admin\LotteryOrder::class,'get_poster']);
 
     /* 下单抽奖 */
     // 列表
@@ -436,13 +445,16 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     /* 打卡活动 */
     // 列表
     Route::any('score_clockin_active/index',[App\Http\Controllers\Admin\ScoreClockinActive::class,'index']);
-    // 详情
+    // 添加
     Route::any('score_clockin_active/add',[App\Http\Controllers\Admin\ScoreClockinActive::class,'add']);
-    // 详情
+    // 编辑
     Route::any('score_clockin_active/edit',[App\Http\Controllers\Admin\ScoreClockinActive::class,'edit']);
+    // 复制
+    Route::any('score_clockin_active/copy',[App\Http\Controllers\Admin\ScoreClockinActive::class,'copy']);
     // 状态
     Route::any('score_clockin_active/set_status',[App\Http\Controllers\Admin\ScoreClockinActive::class,'set_status']);
-    Route::any('score_clockin_active/copy',[App\Http\Controllers\Admin\ScoreClockinActive::class,'copy']);
+    // 海报
+    Route::any('score_clockin_active/get_poster',[App\Http\Controllers\Admin\ScoreClockinActive::class,'get_poster']);
 
     //打卡记录
     Route::any('custom_clockin_record/index',[App\Http\Controllers\Admin\CustomClockinRecord::class,'index']);
@@ -521,6 +533,8 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     Route::any('recruitment_active/copy',[App\Http\Controllers\Admin\RecruitmentActive::class,'copy']);
     // 状态
     Route::any('recruitment_active/set_status',[App\Http\Controllers\Admin\RecruitmentActive::class,'set_status']);
+    // 状态
+    Route::any('recruitment_active/get_poster',[App\Http\Controllers\Admin\RecruitmentActive::class,'get_poster']);
     //奖励配置
     Route::any('recruitment_active_prize/edit',[App\Http\Controllers\Admin\RecruitmentActivePrize::class,'edit']);
     // 拉新活动数据列表