rabin vor 14 Stunden
Ursprung
Commit
967434b201

+ 5 - 2
src/place/channel/sales/manage/Lib/View.php

@@ -19,8 +19,11 @@ class View
         $content[] = [
             'type' => 'text',
             'name' => '文本',
-            //'content' => 'H5预览链接:<a href="'.$result['h5'].'" target="_blank">点击查看</a>',
-            'content' => 'H5预览链接:' . $result['h5'],
+            'content' => 'H5预览链接:<a href="'.$result['h5'].'" target="_blank">点击查看</a>
+
+
+            <br /><br />微信小程序:<br /><img src="'.$result['applet']['wechat'].'" width="200"/>',
+            //'content' => 'H5预览链接:' . $result['h5'],
             # 样式primary success warning danger info exception
             'style' => 'exception',
         ];

+ 8 - 2
src/place/interface/app/Api/Order.php

@@ -117,10 +117,16 @@ class Order extends Core
     private function getInfo()
     {
         $id = Dever::input('id');
-        if (!$id) {
+        $order = Dever::input('order');
+        if (!$id && !$order) {
             Dever::error('订单信息有误');
         }
-        $info = Dever::db('porder/source')->find(['id' => $id, 'uid' => $this->place->uid]);
+        if ($id) {
+            $where = ['id' => $id, 'uid' => $this->place->uid];
+        } else {
+            $where = ['order_num' => $order, 'uid' => $this->place->uid];
+        }
+        $info = Dever::db('porder/source')->find($where);
         if (!$info) {
             Dever::error('订单信息有误');
         }

+ 25 - 0
src/place/interface/app/Api/User.php

@@ -202,4 +202,29 @@ class User extends Core
         Dever::db('puser/info')->update($this->place->uid, ['parent_uid' => $parent_uid]);
         return 'ok';
     }
+
+    # 获取邀请码
+    public function code()
+    {
+        $account = Dever::input('platform', 'is_string', '账户', 'weixin');
+        $env = Dever::input('env', 'is_numeric', '运行环境', 3);
+        $sales_type = Dever::input('sales_type');
+        $sales_id = Dever::input('sales_id');
+        $type = Dever::input('type');
+        if (!$type) {
+            $type = 0;
+        }
+
+        if (!$sales_type || !$sales_id) {
+            $sales_type = $this->place->info['sales_type'];
+            $sales_id = $this->place->info['sales_id'];
+        }
+
+        $result = Dever::load(\Place\Lib\Info::class)->share($this->place->info['id'], $sales_type, $sales_id, $this->place->uid, false, $type);
+
+        # 小程序
+        $data['qrcode'] = $result['applet']['wechat'];
+        $data['link'] = $result['h5'];
+        return $data;
+    }
 }

+ 183 - 0
src/place/order/app/Lib/Notify.php

@@ -0,0 +1,183 @@
+<?php namespace Porder\Lib;
+use Dever;
+class Notify
+{
+    # 支付回调开始操作 无状态 一般用来做环境处理
+    public function handle_start($sector_id, $place_id, $type, $order_num)
+    {
+        //Dever::input('authorization', 'is_string', '访问码', $place);
+        //Dever::input('authorization', 'set', $place);
+        Dever::load(\Manage\Lib\Util::class)->setAuth('sector', 'sector_place', $sector_id, $place_id);
+    }
+
+    # 支付回调结束操作
+    public function handle_end_commit(){}
+    public function handle_end($sector_id, $place_id, $type, $order_num, $status, $body = [])
+    {
+        $order = Dever::db('porder/' . $type)->find(['order_num' => $order_num]);
+        if ($order && $order['status'] == 1) {
+            if ($status == 1) {
+                # 抵扣
+                $this->deduct($type, $order);
+            }
+            $method = $type . '_callback';
+            $this->$method($order, $status);
+        }
+    }
+
+    # 抵扣
+    private function deduct($order)
+    {
+        # 使用优惠券
+        if (isset($order['user_coupon_id']) && $order['user_coupon_id'] > 0) {
+            Dever::load(\Puser\Lib\Coupon::class)->use($type, $order, $this->set['score']);
+        }
+        # 使用礼品卡
+        if (isset($order['user_gift_id']) && $order['user_gift_id'] > 0) {
+            Dever::load(\Puser\Lib\Gift::class)->use($type, $order, $this->set['score']);
+        }
+        # 使用钱包支付
+        if (isset($order['wallet_cash']) && $order['wallet_cash'] > 0) {
+            $name = Dever::db('porder/' . $type . '_detail')->columns(['order_id' => $order['id']], 'name');
+            Dever::load(\Pscore\Lib\Log::class)->action('购买', $order['score_id'])->add($order['uid'], implode('、', $name), $order['wallet_cash']*-1);
+        }
+        # 返利
+        $rebate = Dever::db('porder/rebate')->select(['table' => $type, 'table_id' => $order['id']]);
+        if ($rebate) {
+            $status = 1;
+            if ($type == 'source') {
+                $status = 2;
+            }
+            foreach ($rebate as $k => $v) {
+                if ($v['level'] == 0) {
+                    # 给自己返利
+                    Dever::load(\Pscore\Lib\Log::class)->action('返利', $v['score_id'])->add($order['uid'], $v['name'], $v['value'], $status, $type . '_order_' . $order['id']);
+                } else {
+                    # 给上级返利
+                    $parent = Dever::load(\Invite\Lib\Relation::class)->getParent($order['uid'], $v['level']);
+                    if ($parent) {
+                        Dever::load(\Pscore\Lib\Log::class)->action('返利', $v['score_id'])->add($parent['uid'], $v['name'], $v['value'], $status, $type . '_order_' . $order['id']);
+                    }
+                }
+            }
+        }
+    }
+
+    # 资源支付成功回调
+    protected function source_callback($order, $status)
+    {
+        if ($status == 1) {
+            $update['status'] = 2;
+            $msg = '支付成功';
+        } else {
+            $update['status'] = 7;
+            $msg = '支付失败';
+        }
+        $update['pdate'] = time();
+        $state = Dever::db('porder/source')->update($order['id'], $update);
+        if (!$state) {
+            return '订单更新失败';
+        }
+        if ($order['pay_cash'] > 0) {
+            Dever::load(\Porder\Lib\Source\Log::class)->up(1, $order['uid'], $order['id'], $msg);
+        }
+        if ($state) {
+            if ($update['status'] == 7) {
+                # 恢复库存
+                Dever::load(\Pstock\Lib\Info::class)->refundAll($order);
+            } elseif ($order['status'] == 2) {
+                # 自动发货
+                $num = Dever::db('porder/source_detail')->count(['order_id' => $order['id'], 'source_type' => 10]);
+                if ($num) {
+                    $total = Dever::db('porder/source_detail')->count(['order_id' => $order['id']]);
+                    if ($total == $num) {
+                        # 不发货,订单直接完成即可
+                        Dever::load(\Porder\Lib\Source\Order::class)->finish(1, $order, true);
+                    }
+                }
+            }
+        }
+    }
+
+    # 角色支付回调
+    protected function role_callback($order, $status)
+    {
+        if ($status == 1) {
+            $update['status'] = 2;
+            $msg = '支付成功';
+        } else {
+            $update['status'] = 3;
+            $msg = '支付失败';
+        }
+        
+        $update['pdate'] = time();
+        $state = Dever::db('porder/role')->update($order['id'], $update);
+        if (!$state) {
+            return '订单更新失败';
+        }
+        if ($order['pay_cash'] > 0) {
+            Dever::load(\Porder\Lib\Role\Log::class)->up(1, $order['uid'], $order['id'], $msg);
+        }
+        if ($status == 1) {
+            $detail = Dever::db('porder/role_detail')->select(['order_id' => $order['id']], ['order' => 'level asc']);
+            if ($detail) {
+                foreach ($detail as $v) {
+                    Dever::load(\Prole\Lib\User::class)->up($order['uid'], $v['role_id'], $v['level_id'], $order['sales_type'], $order['sales_id'], 1, $order['id'], '订单号:' . $order['order_num']);
+                }
+
+                $this->sales($order, $this->type);
+            }
+        }
+    }
+
+    # 发放销售渠道收益
+    public function sales($order, $type = 'source')
+    {
+        if ($order['sales_type'] && $order['sales_id']) {
+            $sales = Dever::load(\Psales\Lib\Info::class)->get($order['sales_type'], $order['sales_id']);
+            if ($sales && $sales['uid']) {
+                $benefit = Dever::db('pbenefit/sales')->find(['sales_cate_id' => $sales['cate_id'], 'status' => 1]);
+                if ($benefit && $benefit['score_id']) {
+                    # 平台发货
+                    $table = 'sales_rebate_platform';
+                    if (isset($order['method']) && $order['method'] >= 2) {
+                        # 店铺发货
+                        $table = 'sales_rebate';
+                    }
+                    $rebate = Dever::db('pbenefit/' . $table)->select(['sales_id' => $benefit['id']]);
+                    if ($rebate) {
+                        $detail = Dever::db('porder/' . $type . '_detail')->select(['order_id' => $order['id']]);
+                        $score = Dever::load(\Pscore\Lib\Info::class)->get($order['score_id']);
+                        foreach ($rebate as $k => $v) {
+                            # 先检测购买人等级
+                            if ($v['role']) {
+                                $t = explode(',', $v['role']);
+                                $check = Dever::load(\Prole\Lib\User::class)->check($order['uid'], $t[0], $t[1]);
+                                if (!$check) {
+                                    unset($rebate[$k]);
+                                    continue;
+                                }
+                            }
+                        }
+                        $value = 0;
+                        foreach ($detail as $k => $v) {
+                            if ($v['pay_cash'] > 0) {
+                                if (isset($v['refund_cash']) && $v['refund_cash'] > 0) {
+                                    $v['pay_cash'] -= $v['refund_cash'];
+                                }
+                                if ($v['pay_cash'] > 0) {
+                                    $money = Dever::math('mul', $v['pay_cash'], $score['exp']);
+                                    $value += Dever::load(\Pbenefit\Lib\Item::class)->load('sales')->rebate($order['uid'], $v['scope'], $v['promotion_id'], $rebate, $money);
+                                }
+                            }
+                        }
+                        if ($value > 0) {
+                            # 给关联用户发收益
+                            Dever::load(\Pscore\Lib\Log::class)->action('店铺收益', $benefit['score_id'])->add($sales['uid'], $sales['name'] . '订单:' . $order['order_num'], $value, 1, $type . '_order_' . $order['id'], $order['sales_type'], $order['sales_id']);
+                        }
+                    }
+                }
+            }
+        }
+    }
+}

+ 4 - 109
src/place/order/app/Lib/Pay.php

@@ -249,7 +249,7 @@ class Pay
             $this->order['name'] = implode('、', $this->order['name']);
         }
         $this->order['order_num'] = Dever::load(\Api\Lib\Util::class)->createNumber($prefix, $table);
-        $this->order['notify'] = $table . '/pay.notify|' . $this->place->sector['id'] . '|'  . $this->place->info['id'] . '|' . $this->order['order_num'];
+        $this->order['notify'] = 'Porder/Lib/Notify.handle|' . $this->place->sector['id'] . '|'  . $this->place->info['id'] . '|' . $this->type . '|' . $this->order['order_num'];
         $this->order['buy_info'] = Dever::input('remark');
 
         $this->check();
@@ -258,9 +258,9 @@ class Pay
         if ($this->order['pay_money_cash'] > 0) {
             $result['pay'] = Dever::load(\Place\Lib\Account::class)->pay($this->order);
             if (isset($result['pay']['link']) && $result['pay']['link']) {
-                //return $result;
+                return $result;
             }
-            $result['pay'] = true;
+            //$result['pay'] = true;
         } else {
             $result['pay'] = true;
         }
@@ -270,7 +270,7 @@ class Pay
                 $result['order_num'] = $this->order['order_num'];
                 $this->success($result['order_id']);
                 if ($result['pay'] === true) {
-                    $this->notify($this->place->sector['id'], $this->place->info['id'], $result['order_num'], 1);
+                    Dever::load(\Porder\Lib\Notify::class)->notify_end($this->place->sector['id'], $this->place->info['id'], $this->type, $result['order_num'], 1);
                 }
             }
         }
@@ -341,109 +341,4 @@ class Pay
         # 设置活跃
         Dever::db('place/code')->update(['code' => $this->place->code], ['status' => 1]);
     }
-
-    # 支付回调
-    public function notify($sector_id, $place_id, $order_num, $status, $body = [])
-    {
-        //Dever::input('authorization', 'is_string', '访问码', $place);
-        //Dever::input('authorization', 'set', $place);
-        Dever::load(\Manage\Lib\Util::class)->setAuth('sector', 'sector_place', $sector_id, $place_id);
-        $order = Dever::db('porder/' . $this->type)->find(['order_num' => $order_num]);
-        if ($order && $order['status'] == 1) {
-            if ($status == 1) {
-                # 抵扣
-                $this->deduct($order);
-            }
-            $this->callback($order, $status);
-        }
-    }
-
-    # 抵扣
-    private function deduct($order)
-    {
-        # 使用优惠券
-        if (isset($order['user_coupon_id']) && $order['user_coupon_id'] > 0) {
-            Dever::load(\Puser\Lib\Coupon::class)->use($this->type, $order, $this->set['score']);
-        }
-        # 使用礼品卡
-        if (isset($order['user_gift_id']) && $order['user_gift_id'] > 0) {
-            Dever::load(\Puser\Lib\Gift::class)->use($this->type, $order, $this->set['score']);
-        }
-        # 使用钱包支付
-        if (isset($order['wallet_cash']) && $order['wallet_cash'] > 0) {
-            $name = Dever::db('porder/' . $this->type . '_detail')->columns(['order_id' => $order['id']], 'name');
-            Dever::load(\Pscore\Lib\Log::class)->action('购买', $order['score_id'])->add($order['uid'], implode('、', $name), $order['wallet_cash']*-1);
-        }
-        # 返利
-        $rebate = Dever::db('porder/rebate')->select(['table' => $this->type, 'table_id' => $order['id']]);
-        if ($rebate) {
-            $status = 1;
-            if ($this->type == 'source') {
-                $status = 2;
-            }
-            foreach ($rebate as $k => $v) {
-                if ($v['level'] == 0) {
-                    # 给自己返利
-                    Dever::load(\Pscore\Lib\Log::class)->action('返利', $v['score_id'])->add($order['uid'], $v['name'], $v['value'], $status, $this->type . '_order_' . $order['id']);
-                } else {
-                    # 给上级返利
-                    $parent = Dever::load(\Invite\Lib\Relation::class)->getParent($order['uid'], $v['level']);
-                    if ($parent) {
-                        Dever::load(\Pscore\Lib\Log::class)->action('返利', $v['score_id'])->add($parent['uid'], $v['name'], $v['value'], $status, $this->type . '_order_' . $order['id']);
-                    }
-                }
-            }
-        }
-    }
-
-    public function sales($order, $type = 'source')
-    {
-        # 发放销售渠道收益
-        if ($order['sales_type'] && $order['sales_id']) {
-            $sales = Dever::load(\Psales\Lib\Info::class)->get($order['sales_type'], $order['sales_id']);
-            if ($sales && $sales['uid']) {
-                $benefit = Dever::db('pbenefit/sales')->find(['sales_cate_id' => $sales['cate_id'], 'status' => 1]);
-                if ($benefit && $benefit['score_id']) {
-                    # 平台发货
-                    $table = 'sales_rebate_platform';
-                    if (isset($order['method']) && $order['method'] >= 2) {
-                        # 店铺发货
-                        $table = 'sales_rebate';
-                    }
-                    $rebate = Dever::db('pbenefit/' . $table)->select(['sales_id' => $benefit['id']]);
-                    if ($rebate) {
-                        $detail = Dever::db('porder/' . $type . '_detail')->select(['order_id' => $order['id']]);
-                        $score = Dever::load(\Pscore\Lib\Info::class)->get($order['score_id']);
-                        foreach ($rebate as $k => $v) {
-                            # 先检测购买人等级
-                            if ($v['role']) {
-                                $t = explode(',', $v['role']);
-                                $check = Dever::load(\Prole\Lib\User::class)->check($order['uid'], $t[0], $t[1]);
-                                if (!$check) {
-                                    unset($rebate[$k]);
-                                    continue;
-                                }
-                            }
-                        }
-                        $value = 0;
-                        foreach ($detail as $k => $v) {
-                            if ($v['pay_cash'] > 0) {
-                                if (isset($v['refund_cash']) && $v['refund_cash'] > 0) {
-                                    $v['pay_cash'] -= $v['refund_cash'];
-                                }
-                                if ($v['pay_cash'] > 0) {
-                                    $money = Dever::math('mul', $v['pay_cash'], $score['exp']);
-                                    $value += Dever::load(\Pbenefit\Lib\Item::class)->load('sales')->rebate($order['uid'], $v['scope'], $v['promotion_id'], $rebate, $money);
-                                }
-                            }
-                        }
-                        if ($value > 0) {
-                            # 给关联用户发收益
-                            Dever::load(\Pscore\Lib\Log::class)->action('店铺收益', $benefit['score_id'])->add($sales['uid'], $sales['name'] . '订单:' . $order['order_num'], $value, 1, $type . '_order_' . $order['id'], $order['sales_type'], $order['sales_id']);
-                        }
-                    }
-                }
-            }
-        }
-    }
 }

+ 0 - 30
src/place/order/app/Lib/Role/Pay.php

@@ -44,34 +44,4 @@ class Pay extends Core
 
     # 验证
     protected function check(){}
-    # 支付回调
-    protected function callback($order, $status)
-    {
-        if ($status == 1) {
-            $update['status'] = 2;
-            $msg = '支付成功';
-        } else {
-            $update['status'] = 3;
-            $msg = '支付失败';
-        }
-        
-        $update['pdate'] = time();
-        $state = Dever::db('porder/role')->update($order['id'], $update);
-        if (!$state) {
-            return '订单更新失败';
-        }
-        if ($order['pay_cash'] > 0) {
-            Dever::load(\Porder\Lib\Role\Log::class)->up(1, $order['uid'], $order['id'], $msg);
-        }
-        if ($status == 1) {
-            $detail = Dever::db('porder/role_detail')->select(['order_id' => $order['id']], ['order' => 'level asc']);
-            if ($detail) {
-                foreach ($detail as $v) {
-                    Dever::load(\Prole\Lib\User::class)->up($order['uid'], $v['role_id'], $v['level_id'], $order['sales_type'], $order['sales_id'], 1, $order['id'], '订单号:' . $order['order_num']);
-                }
-
-                $this->sales($order, $this->type);
-            }
-        }
-    }
 }

+ 1 - 1
src/place/order/app/Lib/Source/Order.php

@@ -318,7 +318,7 @@ class Order
                 }
 
                 # 发放销售渠道收益
-                Dever::load(\Porder\Lib\Pay::class)->sales($order, 'source');
+                Dever::load(\Porder\Lib\Notify::class)->sales($order, 'source');
             }
         }
     }

+ 0 - 36
src/place/order/app/Lib/Source/Pay.php

@@ -99,40 +99,4 @@ class Pay extends Core
             }
         }
     }
-
-    # 支付成功回调
-    protected function callback($order, $status)
-    {
-        if ($status == 1) {
-            $update['status'] = 2;
-            $msg = '支付成功';
-        } else {
-            $update['status'] = 7;
-            $msg = '支付失败';
-        }
-        $update['pdate'] = time();
-        $state = Dever::db('porder/source')->update($order['id'], $update);
-        if (!$state) {
-            return '订单更新失败';
-        }
-        if ($order['pay_cash'] > 0) {
-            Dever::load(\Porder\Lib\Source\Log::class)->up(1, $order['uid'], $order['id'], $msg);
-        }
-        if ($state) {
-            if ($update['status'] == 7) {
-                # 恢复库存
-                Dever::load(\Pstock\Lib\Info::class)->refundAll($order);
-            } elseif ($order['status'] == 2) {
-                # 自动发货
-                $num = Dever::db('porder/source_detail')->count(['order_id' => $order['id'], 'source_type' => 10]);
-                if ($num) {
-                    $total = Dever::db('porder/source_detail')->count(['order_id' => $order['id']]);
-                    if ($total == $num) {
-                        # 不发货,订单直接完成即可
-                        Dever::load(\Porder\Lib\Source\Order::class)->finish(1, $order, true);
-                    }
-                }
-            }
-        }
-    }
 }

+ 11 - 2
src/place/set/app/Api/Tool.php

@@ -9,12 +9,21 @@ class Tool
         if (!$code) {
             Dever::error('请输入访问码');
         }
+        $sales_type = $sales_id = $uid = $type = 0;
+        if (strstr($code, '!')) {
+            $temp = explode('!', $code);
+            $code = $temp[0];
+            $sales_type = $temp[1];
+            $sales_id = $temp[2];
+            $uid = $temp[3];
+            $type = $temp[4];
+        }
         $code = Dever::db('place/code')->find(['code' => $code]);
         if (!$code) {
             Dever::error('访问码错误');
         }
-        $result = Dever::load(\Place\Lib\Info::class)->encode($code['sector_id'], $code['user_id'], $code['place_id']);
-        return $result;
+        $result = Dever::load(\Place\Lib\Info::class)->encode($code['sector_id'], $code['user_id'], $code['place_id'], $sales_type, $sales_id, $uid);
+        return ['code' => $result, 'jump' => $type];
     }
 
     public function url()

+ 1 - 1
src/place/set/app/Lib/Account.php

@@ -46,7 +46,7 @@ class Account
             $param['page'] = $page;
             $param['env_version'] = $version;
             $data = Dever::load(\Api\Lib\Account::class)->run($account, 'applet_code', $param, 1, 'run', 'place');
-            print_r($data);die;
+            return $data;
         }
     }
 

+ 23 - 3
src/place/set/app/Lib/Info.php

@@ -21,11 +21,12 @@ class Info
     }
 
     # 生成分享需要的东西
-    public function share($place_id = 0, $sales_type = 0, $sales_id = 0, $uid = 0, $manage = false)
+    public function share($place_id = 0, $sales_type = 0, $sales_id = 0, $uid = 0, $manage = false, $type = 0)
     {
         $result = [];
         $info = Dever::db('place/info')->find($place_id);
         if ($info) {
+            $codeInfo = Dever::db('place/code')->find(['code' => $info['code']]);
             # code 第一个是领域id,第二个账户id,第三个是品牌id
             if ($manage) {
                 # 后台生成
@@ -54,12 +55,31 @@ class Info
             # h5二维码码
             $result['h5_ercode'] = '';
             
+            # 0是频道首页,大于0是资源详情页
+            $scene[0] = $info['code'];
+            $scene[1] = $sales_type;
+            $scene[2] = $sales_id;
+            $scene[3] = $uid;
+            $scene[4] = $type;
+            $scene = implode('!', $scene);
 
-            $code = Dever::load(\Place\Lib\Account::class)->getAppletCode('weixin', 5, 'code=' . $info['code'] . '&jump=', 'pages/main', 'develop');
+            $result['h5'] = $host . '/pages/main?scene=' . $scene;
+
+            $check = Dever::db('place/qrcode')->find(['code' => $scene]);
+            if ($check) {
+                $wechat = $check['value'];
+            } else {
+                $wechat = Dever::load(\Place\Lib\Account::class)->getAppletCode('weixin', 5, $scene, 'pages/main', 'trial');
+                if ($wechat) {
+                    $wechat = Dever::load(\Upload\Lib\Save::class)->init(1)->act($wechat, 'png', false, $scene, true);
+                    $wechat = $wechat['url'];
+                    Dever::db('place/qrcode')->insert(['code' => $scene, 'value' => $wechat]);
+                }
+            }
             # 小程序码
             $result['applet'] = [
                 # 微信小程序
-                'wechat' => $path,
+                'wechat' => $wechat,
                 # 抖音小程序
                 # 快手小程序
                 # 支付宝小程序

+ 2 - 2
src/place/set/manage/account.php

@@ -31,9 +31,9 @@ return [
         'data_button' => [
             '设置' => ['fastedit', 'name,place/account_setting'],
             '证书' => ['route', [
-                'path' => 'set_manage/account_cert',
+                'path' => 'set_api/account_cert',
                 'param' => [
-                    'set' => ['account_id' => 'id', 'menu' => 'set_manage/account', 'parent' => 'set_manage/account'],
+                    'set' => ['account_id' => 'id', 'menu' => 'set_api/account', 'parent' => 'set_api/account'],
                 ],
             ]],
         ],

+ 1 - 1
src/place/set/manage/account_cert.php

@@ -28,7 +28,7 @@ return [
             'platform_cert_id' => [
                 'rules' => true,
                 'type' => 'select',
-                'option'     => 'Dever::call("Api/Lib/App.getCert", "{account_id}")',
+                'option'     => 'Dever::call("Api/Lib/App.getCert", ["{account_id}", "place"])',
                 //'remote' => 'api/manage.getCertName',
                 //'remote_default' => false,
             ],

+ 25 - 2
src/place/set/manage/place.php

@@ -52,8 +52,31 @@ return [
                 'rules' => true,
             ],
             'code' => [
-                'rules' => true,
-                'desc' => '设置访问码之后,用户将可以通过访问码快速进入,访问码不能重复',
+                'maxlength' => 15,
+                'desc' => '设置访问码之后,用户将可以通过访问码快速进入<br />访问码不能包含特殊字符,只能使用字母和数字。',
+                'rules'     => [
+                    # 规则1
+                    [
+                        # 必填
+                        'required' => true,
+                        # 输入后触发
+                        'trigger' => 'blur',
+                        # 提示信息
+                        'message' => '请输入访问码',
+                    ],
+                    # 规则2
+                    [
+                        # 最小字符
+                        'min' => 3,
+                        # 最大字符
+                        'max' => 15,
+                        'pattern' => '^[A-Za-z0-9]+$',
+                        'trigger' => 'blur',
+                        # 提示信息
+                        'message' => '访问码不能包含特殊字符,长度不能小于3个字符或者大于15个字符',
+                        'type' => 'string',
+                    ],
+                ],
             ],
 
             'money_id' => [

+ 1 - 1
src/place/set/table/info.php

@@ -47,7 +47,7 @@ return [
 
         'code' => [
             'name'      => '访问码',
-            'type'      => 'varchar(80)',
+            'type'      => 'varchar(20)',
         ],
 
         'price' => [

+ 19 - 0
src/place/set/table/qrcode.php

@@ -0,0 +1,19 @@
+<?php
+return [
+    'name' => '二维码记录表',
+    'partition' => 'Dever::call("Manage/Lib/Util.system")',
+    'struct' => [
+        'code'      => [
+            'type'      => 'varchar(80)',
+            'name'      => '编码',
+        ],
+
+        'value'       => [
+            'type'      => 'varchar(300)',
+            'name'      => '二维码图片',
+        ],
+    ],
+    'index' => [
+        'search' => 'code',
+    ],
+];

+ 12 - 0
src/sector/app/Api/Cron.php

@@ -42,4 +42,16 @@ class Cron
             $call($place, $time);
         }
     }
+
+    # 更新微信运力列表
+    public function getWechatDelivery()
+    {
+        $param = [];
+        $token = Dever::load(\Api\Lib\Util::class)->token('weixin', 5);
+        if ($token) {
+            $param['access_token'] = $token;
+            $data = Dever::load(\Api\Lib\Account::class)->run('weixin', 'delivery', $param);
+            return $data;
+        }
+    }
 }

+ 9 - 9
src/sector/table/delivery.php

@@ -35,21 +35,21 @@ return [
             //'"商家自配", "self_delivery", 1,' . DEVER_TIME,
 
             # 实物发货
-            '"顺丰", "SFEXPRESS", 1,' . DEVER_TIME,
-            '"安鲜达", "EXFRESH", 1,' . DEVER_TIME,
-            '"丰网速运", "FWSY", 1,' . DEVER_TIME,
+            '"顺丰", "SF", 1,' . DEVER_TIME,
+            '"丰网速运", "FWX", 1,' . DEVER_TIME,
             '"EMS", "EMS", 1,' . DEVER_TIME,
             '"申通", "STO", 1,' . DEVER_TIME,
             '"圆通", "YTO", 1,' . DEVER_TIME,
             '"中通", "ZTO", 1,' . DEVER_TIME,
-            '"韵达快递", "YUNDA", 1,' . DEVER_TIME,
-            '"极兔速递", "JITU", 1,' . DEVER_TIME,
+            '"韵达速递", "YD", 1,' . DEVER_TIME,
+            '"极兔速递", "JTSD", 1,' . DEVER_TIME,
+            '"百世快递", "HTKY", 1,' . DEVER_TIME,
             '"京东", "JD", 1,' . DEVER_TIME,
+            '"邮政包裹", "YZPY", 1,' . DEVER_TIME,
+            '"顺心捷达", "SX", 1,' . DEVER_TIME,
+            '"丹鸟快递", "DNWL", 1,' . DEVER_TIME,
+            '"安鲜达", "AXD", 1,' . DEVER_TIME,
             '"八达通", "BDT", 1,' . DEVER_TIME,
-            '"邮政包裹", "CHINAPOST", 1,' . DEVER_TIME,
-            '"顺心捷达", "SXJD", 1,' . DEVER_TIME,
-            '"丹鸟快递", "DANNIAO", 1,' . DEVER_TIME,
-            '"百世快递", "HTKY", 1,' . DEVER_TIME,
 
             # 虚拟发货
             '"网盘", "pan", 2,' . DEVER_TIME,