diff --git a/.gitignore b/.gitignore index b209131..dad3644 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,6 @@ /thinkphp/ /vendor/ /runtime/* -/addons/* -/public/assets/libs/ -/public/assets/addons/* /public/uploads/* .idea composer.lock diff --git a/1648259863_20230821_cert.zip b/1648259863_20230821_cert.zip new file mode 100644 index 0000000..6f2c703 Binary files /dev/null and b/1648259863_20230821_cert.zip differ diff --git a/1649053789_20230726_cert.zip b/1649053789_20230726_cert.zip new file mode 100644 index 0000000..6d548d0 Binary files /dev/null and b/1649053789_20230726_cert.zip differ diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index ca0f3d1..d5f6771 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -64,9 +64,6 @@ class Index extends Backend //获取公司信息 $admin = Session::get('admin')?Session::get('admin'):Session::get('member'); - - - $action = $this->request->request('action'); if ($this->request->isPost()) { if ($action == 'refreshmenu') { @@ -264,7 +261,6 @@ class Index extends Backend $data['group_ids'] = $result4; $data['department_id'] = $result5; $data['role'] = $result5; - $data['post'] = "负责人"; $data['mobile'] = $mobile; $data['name'] = "用户".rand(100000,999999); @@ -285,13 +281,18 @@ class Index extends Backend } $result = $suerModel->getLastInsID(); + // 获取对应的admin账号 + $uinfos = Db::name('admin')->where("username",'=',$mobile)->find(); + $suerModel->where("id","=",$result)->update(["admin_id"=>$uinfos['id']]); + Db::name('admin')->where("id",'=',$uinfos['id'])->update(["cid"=>$result2]); + //建立企业与个人绑定关系 $userCompany['cid'] =$result2; - $userCompany['uid'] =$result; + $userCompany['uid'] =$uinfos['id']; $usercompanyModel = new MemberCompany(); $usercompanyModel->save($userCompany); - $memberGroupAccess['uid'] = $result; + $memberGroupAccess['uid'] = $uinfos['id']; $memberGroupAccess['cid'] = $result2; $memberGroupAccess['group_id'] = $result4; $memberGroupAccessModel = new MemberGroupAccess(); diff --git a/application/admin/controller/qingdong/customer/Customer.php b/application/admin/controller/qingdong/customer/Customer.php index 9e1d1e4..0ed0ef0 100644 --- a/application/admin/controller/qingdong/customer/Customer.php +++ b/application/admin/controller/qingdong/customer/Customer.php @@ -934,7 +934,7 @@ class Customer extends Base if (!empty($name)) { $where['name'] = ['like', '%' . $name . '%']; } - $staff = Staff::where($where)->field('id,name')->order('id desc')->paginate($pageSize, false, ['page' => $pageNumber]); + $staff = Staff::where($where)->where('cid','=',CID)->field('id,name')->order('id desc')->paginate($pageSize, false, ['page' => $pageNumber]); return json(['list' => $staff->items(), 'total' => $staff->total()]); } diff --git a/application/admin/controller/qingdong/customer/Receivables.php b/application/admin/controller/qingdong/customer/Receivables.php index 8af6f0e..8c0d95e 100644 --- a/application/admin/controller/qingdong/customer/Receivables.php +++ b/application/admin/controller/qingdong/customer/Receivables.php @@ -264,7 +264,7 @@ class Receivables extends Base { if(!empty($name)){ $where['name'] = ['like','%'.$name.'%']; } - $staff = Staff::where($where)->where(['id'=>['neq',$this->_staff->id]])->field('id,name')->order('id desc')->paginate($pageSize, false, ['page' => $pageNumber]); + $staff = Staff::where($where)->where(['cid'=>CID,'id'=>['neq',$this->_staff->id]])->field('id,name')->order('id desc')->paginate($pageSize, false, ['page' => $pageNumber]); return json(['list' => $staff->items(), 'total' => $staff->total()]); } diff --git a/application/admin/controller/qingdong/leads/Record.php b/application/admin/controller/qingdong/leads/Record.php index eacbcb3..96f2406 100644 --- a/application/admin/controller/qingdong/leads/Record.php +++ b/application/admin/controller/qingdong/leads/Record.php @@ -136,7 +136,7 @@ class Record extends Base { $this->error('创建失败'); } $follow= Field::getField('客户状态'); - $staff=Staff::where([])->column('name','id'); + $staff=Staff::where(['cid'=>CID])->column('name','id'); if($ids){ $leads=Leads::where(['id'=>$ids])->column('id,name'); diff --git a/application/admin/controller/qingdong/product/Member.php b/application/admin/controller/qingdong/product/Member.php index e029a4c..144ebdd 100644 --- a/application/admin/controller/qingdong/product/Member.php +++ b/application/admin/controller/qingdong/product/Member.php @@ -13,6 +13,7 @@ use addons\qingdong\model\ProductWarehouse; use addons\qingdong\model\Staff; use app\admin\controller\qingdong\Base; use app\admin\model\AuthGroup; +use EasyWeChat\Factory; use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Reader\Csv; use PhpOffice\PhpSpreadsheet\Reader\Xls; @@ -133,11 +134,26 @@ class Member extends Base */ public function buy($ids = null) { + //获取当前用户所在企业的权限组 + $company = Db::name('company')->where("id",CID)->find(); + $group_id = $company['group_id']; + + $row = $this->model->get($ids); + + //获取所有权限 + $productNow= Db::name('product')->where('group_id','=',$group_id)->find(); + if($productNow && $productNow['group_level'] >= $row['group_level']){ + return $this->success("无需升级",url("/qingdong/product/member/detail","ids={$ids}")); + } + + + $orderModel = new Order(); + $orderNo = date('YmdHis')+rand(1000,9999); $data = [ 'type' => 0, - 'order_no' => date('YmdHis')+rand(1000,9999), + 'order_no' => $orderNo, 'user_id' => $this->_staff?$this->_staff->id:'0', 'price' => $row['price'], 'title' => $row['name'], @@ -155,9 +171,49 @@ class Member extends Base ]; $orderModel->save($data); + // 创建 EasyWeChat 实例 + $payment = config('payment'); + +// $config['payment'] = $payment; + $app = Factory::payment($payment); + + // 构建微信支付订单参数 + $paymentParams = [ + 'body' => "购买会员套餐服务", + 'out_trade_no' => $orderNo, + 'total_fee' => $row['price'] * 100, // 转换为分 + 'spbill_create_ip' => $_SERVER['REMOTE_ADDR'], // 客户端IP + 'notify_url' => $payment['notify_url'], + 'trade_type' => 'NATIVE', // 扫码支付类型 + ]; + + // 调用 EasyWeChat 的统一下单方法 + $result = $app->order->unify($paymentParams); + + // 获取支付二维码链接 + $payQrCodeUrl = $result['code_url']; + + vendor('phpqrcode.phpqrcode'); + $url= $payQrCodeUrl; + $size=4; //图片大小 + $errorCorrectionLevel = "Q"; // 容错级别:L、M、Q、H + $matrixPointSize = "4"; // 点的大小:1到10 + //实例化 + $qr = new \QRcode(); + //打开缓冲区 + ob_start(); + $res = $qr::png($url, false, $errorCorrectionLevel, $matrixPointSize); + $qrcode = base64_encode(ob_get_contents()); + + //会清除缓冲区的内容,并将缓冲区关闭,但不会输出内容。 + ob_end_clean(); + $this->assign('qrcode',$qrcode); + $this->assign('row', $row); $this->assign('data', $data); $this->assign('ids', $ids); +// $this->assign('qrcode', $payQrCodeUrl); + //下单 return $this->view->fetch(); } @@ -193,5 +249,45 @@ class Member extends Base } + public function complate(){ + + // 创建 EasyWeChat 实例 + $payment = config('payment'); + $app = Factory::payment($payment); + // 处理支付回调通知 + $response = $app->handlePaidNotify(function ($message, $fail) { + // 处理订单支付状态更新等业务逻辑 + // 用户是否支付成功 + if ($message['result_code'] === 'SUCCESS') { + $extra['transaction_id'] = + // 获取订单信息 + $order_no = $message['out_trade_no']; // 假设订单号在回调通知中的字段名为 out_trade_no + $total_free = $message['total_fee']; // 假设订单金额在回调通知中的字段名为 total_fee + + $orderModel = new Order(); + $order = $orderModel->where("order_no","=",$order_no)->find(); + if(!$order || $order['pay_status'] == 1){ + return true; + } + + $update = [ + "pay_status" => 1, + "pay_way" => 1, + "pay_money" => round($total_free/100,2), + "pay_time" => time(), + "transaction_id" =>$message['transaction_id'], + ]; + $orderModel->where("id","=",$order['id'])->update($update); + } + + // 返回 true 告诉 EasyWeChat 支付通知处理成功 + return true; + }); + + return $response; + + } + + } diff --git a/application/admin/controller/qingdong/product/Memberproduct.php b/application/admin/controller/qingdong/product/Memberproduct.php index 96582d1..5312298 100644 --- a/application/admin/controller/qingdong/product/Memberproduct.php +++ b/application/admin/controller/qingdong/product/Memberproduct.php @@ -143,6 +143,7 @@ class Memberproduct extends Base $this->error('修改失败'); } } + $data = $this->model->where($map)->find(); $this->view->assign("row", $data); diff --git a/application/admin/library/Auth.php b/application/admin/library/Auth.php index 599ba0a..c688069 100644 --- a/application/admin/library/Auth.php +++ b/application/admin/library/Auth.php @@ -96,6 +96,7 @@ class Auth extends \fast\Auth $admin->logintime = time(); $admin->loginip = request()->ip(); $admin->token = Random::uuid(); + $admin->save(); Session::set("admin", $admin->toArray()); return true; @@ -541,6 +542,7 @@ class Auth extends \fast\Auth // 读取管理员当前拥有的权限节点 $userRule = $this->getRuleList2(); + $selected = $referer = []; $refererUrl = Session::get('referer'); // 必须将结果集转换为数组 diff --git a/application/admin/model/Company.php b/application/admin/model/Company.php index b55fd87..b5f3bdc 100644 --- a/application/admin/model/Company.php +++ b/application/admin/model/Company.php @@ -14,7 +14,7 @@ class Company extends Model // 自动写入时间戳字段 protected $autoWriteTimestamp = 'int'; // 定义时间戳字段名 - protected $createTime = 'create_time'; - protected $updateTime = 'update_time'; + protected $createTime = 'createtime'; + protected $updateTime = 'updatetime'; } diff --git a/application/admin/view/qingdong/product/member/buy.html b/application/admin/view/qingdong/product/member/buy.html index ce6a8ff..fef4309 100644 --- a/application/admin/view/qingdong/product/member/buy.html +++ b/application/admin/view/qingdong/product/member/buy.html @@ -65,23 +65,36 @@ +
+
+
+ 订单支付二维码 +
+
+
+
+ -
+
-
-
+
+
产品描述: {$row.description|htmlspecialchars_decode}
+ +
+ + + +
+
+ 支付二维码: + +
+
+
+
+ \ No newline at end of file diff --git a/application/api/controller/Demo.php b/application/api/controller/Demo.php index 3a992e4..c4accbf 100644 --- a/application/api/controller/Demo.php +++ b/application/api/controller/Demo.php @@ -70,4 +70,6 @@ class Demo extends Api $this->success('返回成功', ['action' => 'test3']); } + + } diff --git a/application/api/controller/Pay.php b/application/api/controller/Pay.php new file mode 100644 index 0000000..b661b05 --- /dev/null +++ b/application/api/controller/Pay.php @@ -0,0 +1,79 @@ +200]; + } + + + public function notify(){ + + // 创建 EasyWeChat 实例 + $payment = config('payment'); + $app = Factory::payment($payment); + // 处理支付回调通知 + $response = $app->handlePaidNotify(function ($message, $fail) { + // 处理订单支付状态更新等业务逻辑 + // 用户是否支付成功 + if ($message['result_code'] === 'SUCCESS') { + $extra['transaction_id'] = + // 获取订单信息 + $order_no = $message['out_trade_no']; // 假设订单号在回调通知中的字段名为 out_trade_no + $total_free = $message['total_fee']; // 假设订单金额在回调通知中的字段名为 total_fee + + $orderModel = new Order(); + $order = $orderModel->where("order_no","=",$order_no)->find(); + if(!$order || $order['pay_status'] == 1){ + return true; + } + + $update = [ + "pay_status" => 1, + "pay_way" => 1, + "pay_money" => round($total_free/100,2), + "pay_time" => time(), + "transaction_id" =>$message['transaction_id'], + ]; + $orderModel->where("id","=",$order['id'])->update($update); + + + //获取权限 更新当前企业的权限 + $product = Db::name("product")->where("id",'=',$order['org_id'])->find(); + if($product){ + $group_id = $product['group_id']; + $expire_time = strtotime("+1 years"); + $update2 = [ + "group_id" => $group_id, + "expire_time" => $expire_time, + "is_pay" => 1, + "is_default" => 0, + ]; + Db::name("company")->where("id","=",$order['cid'])->update($update2); + } + + } + + // 返回 true 告诉 EasyWeChat 支付通知处理成功 + return true; + }); + + return $response; + + } + + +} diff --git a/application/config.php b/application/config.php index ce98465..92ebcb7 100644 --- a/application/config.php +++ b/application/config.php @@ -301,4 +301,13 @@ return [ //API接口地址 'api_url' => 'https://api.fastadmin.net', ], + 'payment' => [ + 'sandbox' => false, // 是否使用沙箱模式,开发阶段建议使用沙箱模式进行测试 + 'app_id' => 'wx9b57905f0ab7e1bd', + 'mch_id' => '1648259863', + 'key' => '00b7691d86d96aebd21dd9e138f90840', + 'cert_path' => ROOT_PATH.'cert/apiclient_cert.pem', // 证书文件路径 + 'key_path' => ROOT_PATH.'cert/apiclient_key.pem',// 密钥文件路径 + 'notify_url' => 'http://shunshicrm.iiixo.com/pay/api/pay/notify', // 支付回调通知URL + ], ]; diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index 452ff98..3b092b1 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -13,7 +13,8 @@ class Index extends Frontend public function index() { - return $this->view->fetch(); + $this->redirect("/backend.php/index/index"); +// return $this->view->fetch(); } } diff --git a/application/route.php b/application/route.php index 8d93637..83cb18c 100644 --- a/application/route.php +++ b/application/route.php @@ -23,3 +23,5 @@ return [ // 'api' => 'api', // ], ]; + + diff --git a/cert/apiclient_cert.p12 b/cert/apiclient_cert.p12 new file mode 100644 index 0000000..be16ecb Binary files /dev/null and b/cert/apiclient_cert.p12 differ diff --git a/cert/apiclient_cert.pem b/cert/apiclient_cert.pem new file mode 100644 index 0000000..0bb4335 --- /dev/null +++ b/cert/apiclient_cert.pem @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIEKDCCAxCgAwIBAgIUMNGfqb6ZKjfMhkLZSklUE1kdYAkwDQYJKoZIhvcNAQEL +BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT +FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg +Q0EwHhcNMjMwODIxMDkwOTQ5WhcNMjgwODE5MDkwOTQ5WjCBgTETMBEGA1UEAwwK +MTY0ODI1OTg2MzEbMBkGA1UECgwS5b6u5L+h5ZWG5oi357O757ufMS0wKwYDVQQL +DCTlronlvr3noZXoiJzpgJrkv6Hnp5HmioDmnInpmZDlhazlj7gxCzAJBgNVBAYM +AkNOMREwDwYDVQQHDAhTaGVuWmhlbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBAMYUTLC2tJc5ds8kjEpy8CnHVCgpjAKC22gal+N3nSxlTmD8Re87JRvZ +B1ERr6f/u0w8IAwufn1iZ0ANhdRnapUiPowzJo+GY0zy7ZUv7tZb1nNa/Po/bC0I +2b3eMV7r5dhyDrSgpCWXFckVUbG5oU8CmqcEMKph6Z+m1A5bQhCE8eYnz99v8tjO +Sk9TPbKOVwhxE9PDPitjVo0bo3dgrZOETdsnOzoU3twm9owccJlCzelkt0kHPPOe +dwp7lqJkNTYSYwOVH6nE8khg8vuWjiSdM3ZBJGsIJ9l1czKQtJv9TS2dLATw9D3I +uuMA//f8OHXeT1OlDGnJQTGUjkE6dWECAwEAAaOBuTCBtjAJBgNVHRMEAjAAMAsG +A1UdDwQEAwID+DCBmwYDVR0fBIGTMIGQMIGNoIGKoIGHhoGEaHR0cDovL2V2Y2Eu +aXRydXMuY29tLmNuL3B1YmxpYy9pdHJ1c2NybD9DQT0xQkQ0MjIwRTUwREJDMDRC +MDZBRDM5NzU0OTg0NkMwMUMzRThFQkQyJnNnPUhBQ0M0NzFCNjU0MjJFMTJCMjdB +OUQzM0E4N0FEMUNERjU5MjZFMTQwMzcxMA0GCSqGSIb3DQEBCwUAA4IBAQB5IX/C +HxwL9WgBVuz5ZctG+UFW1jXtVNmdtG1fUCFMy9SAMXmXRdn1sufB+K0BC6bEFH+f +OdIlAKcidRu7iEN1bWQRlP1FHLZ95lZQfGN6Wzcg5JCo1Nbc9NZn2gFL1Wej11iA +tVxJ1H3MYUBQGCO8P34HRhmhK5zSW9JNs5J/al+DwvNPbPX7Of7a66qqjM93toXd +PICyz9a4rcyNNR4pGT+6KzSg4SmqFRsJZBb0sIa5bjIdaiVR9Xo0078cvscsLfNb +OTqzd8qkXI2AAfoL1OwAMjNReVQY1ECJE/4//IGtUyK/QK5yA4r2lw82pXkwUGYy +6FnQWDxBpfUdd0ap +-----END CERTIFICATE----- diff --git a/cert/apiclient_key.pem b/cert/apiclient_key.pem new file mode 100644 index 0000000..b252f02 --- /dev/null +++ b/cert/apiclient_key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDGFEywtrSXOXbP +JIxKcvApx1QoKYwCgttoGpfjd50sZU5g/EXvOyUb2QdREa+n/7tMPCAMLn59YmdA +DYXUZ2qVIj6MMyaPhmNM8u2VL+7WW9ZzWvz6P2wtCNm93jFe6+XYcg60oKQllxXJ +FVGxuaFPApqnBDCqYemfptQOW0IQhPHmJ8/fb/LYzkpPUz2yjlcIcRPTwz4rY1aN +G6N3YK2ThE3bJzs6FN7cJvaMHHCZQs3pZLdJBzzznncKe5aiZDU2EmMDlR+pxPJI +YPL7lo4knTN2QSRrCCfZdXMykLSb/U0tnSwE8PQ9yLrjAP/3/Dh13k9TpQxpyUEx +lI5BOnVhAgMBAAECggEAX2DE8M55NNwptmKt3udrd2KQxmoDDe5+wakUfCZLm2YI +kLDI6AH9w2QEnue6QlXklTfaYqM8qxloCDK6v2UwsDD2F0JGDhQy2ombFxwmkDdW +kuM8Ly+84g6B8mf8M+25FjkNlbJIeAVBKztFxCNTZh0l5Mgiutg8y3BkaalNrW/M +ixZfpGb+2RQakWkgAD7fMIl+p9J1xezLI/mm+nXuN372l5jnL4yvWSdGVkcJRYNT +6ldphI0uwVCrkOR5pS8JQ161pUGZzHbKM27wEONnh4w6sNdxdyE+ok4eMI9Fmnsp +/XU3glQ9hHEHklRFLWxlPatQDDBB9MCILmsLQ5CV1QKBgQD6UJKjMHQqYoVrS72g +CLTzbqU0W9xWDwPqSCsUbVY0PcD3TR552H/nfn0IlgwUENn73D3WvQNTcPxxL7pW ++ILkMB6s9JMwz59O6c+pRg2qSPZGEzmIXcX44fhHMv1EbKW9SdqS6fO9+DRNTDqQ +ZOjJGf5J4eYyP96WwXyb5ZSrDwKBgQDKlAJ1JPrdRP6jaKJAYpuiedYiKDSsrU12 +NXBR3xyAixusGkaUvl0GT196m5vS4PmIThq78ctwnd7dufsX2eZC6aPpCWAoMHtE +KV2sY3up40u6EVywXlO/nvQJlqwGebnEC/ieQJd3/f4M2MlHdi7wPRFzq5VyIaeF +UP04IIKYjwKBgQDnY7AJ1nKr86LtyngiBapwFWn1+qy1iO/PlKLuIRw88pD8ineP +nwitUAn48+t6aRF4duFbLiJy8dEKOFqCpvsoQSs6KmQeDO9xHUXvbmiXbxbpNEBM +xJKLPSgreQESTXTwg+LfSBEfHOAMTFkevYlKzRJ57a7D6LK0nWu5GQLTFQKBgDE+ +V3aYfa7qBag9WCukjMarLUVyVpOfMRRKGzqbrLcGmbx1SrD/sWdGRiRszS0u6Rmc +Ot1zAowmpDVr70C2BEZBu0l7sPc0CdLg51dve3Epwo/BhrGMzHjpL9Ng4AJW9rRU +YKQ/eVJ+2JHQ5OTNMs3NWn+utw5eZfV/YX6SUIy7AoGBAJH0pFbJriBNUpaQSQU9 +x5deR9XKMSzUPH9gzCI1qaolbiC3zuOsEcX/N5VVWYYD6vmtNI7oxKDuE43fLzU0 +eMhs5Zc2oHEfj0672pAqaqlhGhqMaZB34EP6cs2zNWw3YBmcZ6Thaldfy55KLxOI +Qw8PlUQyKTFcRLGWlEUZ5YH8 +-----END PRIVATE KEY----- diff --git a/cert/证书使用说明.txt b/cert/证书使用说明.txt new file mode 100644 index 0000000..9a0aab1 --- /dev/null +++ b/cert/证书使用说明.txt @@ -0,0 +1,18 @@ +欢迎使用微信支付! +附件中的三份文件(证书pkcs12格式、证书pem格式、证书密钥pem格式),为接口中强制要求时需携带的证书文件。 +证书属于敏感信息,请妥善保管不要泄露和被他人复制。 +不同开发语言下的证书格式不同,以下为说明指引: + 证书pkcs12格式(apiclient_cert.p12) + 包含了私钥信息的证书文件,为p12(pfx)格式,由微信支付签发给您用来标识和界定您的身份 + 部分安全性要求较高的API需要使用该证书来确认您的调用身份 + windows上可以直接双击导入系统,导入过程中会提示输入证书密码,证书密码默认为您的商户号(如:1900006031) + 证书pem格式(apiclient_cert.pem) + 从apiclient_cert.p12中导出证书部分的文件,为pem格式,请妥善保管不要泄漏和被他人复制 + 部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供 + 您也可以使用openssl命令来自己导出:openssl pkcs12 -clcerts -nokeys -in apiclient_cert.p12 -out apiclient_cert.pem + 证书密钥pem格式(apiclient_key.pem) + 从apiclient_cert.p12中导出密钥部分的文件,为pem格式 + 部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供 + 您也可以使用openssl命令来自己导出:openssl pkcs12 -nocerts -in apiclient_cert.p12 -out apiclient_key.pem +备注说明: + 由于绝大部分操作系统已内置了微信支付服务器证书的根CA证书, 2018年3月6日后, 不再提供CA证书文件(rootca.pem)下载 \ No newline at end of file diff --git a/extend/fast/Auth.php b/extend/fast/Auth.php index f1620f2..5d3fd2d 100644 --- a/extend/fast/Auth.php +++ b/extend/fast/Auth.php @@ -262,7 +262,7 @@ class Auth //如果是企业账户 并且 该账户拥有企业全部权限 if($ism && $uid>=1000000 && count($ids) == 1 && $ids[0] == "*"){ //获取公司的权限 - $userInfo = Db::name("qingdong_staff")->where("id",$uid)->find(); + $userInfo = Db::name("qingdong_staff")->where("admin_id",$uid)->find(); $groupInfo = Db::name("company")->where("id",$userInfo['cid'])->find(); $groups = Db::name("auth_group")->where("id",$groupInfo['group_id'])->find(); $ids = explode(',', trim($groups['rules'], ',')); diff --git a/public/.htaccess b/public/.htaccess index e69de29..d9ee23c 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -0,0 +1,8 @@ + + Options +FollowSymlinks -Multiviews + RewriteEngine On + + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L] + diff --git a/public/assets/js/jquery.qrcode.min.js b/public/assets/js/jquery.qrcode.min.js new file mode 100644 index 0000000..fe9680e --- /dev/null +++ b/public/assets/js/jquery.qrcode.min.js @@ -0,0 +1,28 @@ +(function(r){r.fn.qrcode=function(h){var s;function u(a){this.mode=s;this.data=a}function o(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function q(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var d=0;da||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var a=1,a=1;40>a;a++){for(var c=p.getRSBlocks(a,this.errorCorrectLevel),d=new t,b=0,e=0;e=d;d++)if(!(-1>=a+d||this.moduleCount<=a+d))for(var b=-1;7>=b;b++)-1>=c+b||this.moduleCount<=c+b||(this.modules[a+d][c+b]= +0<=d&&6>=d&&(0==b||6==b)||0<=b&&6>=b&&(0==d||6==d)||2<=d&&4>=d&&2<=b&&4>=b?!0:!1)},getBestMaskPattern:function(){for(var a=0,c=0,d=0;8>d;d++){this.makeImpl(!0,d);var b=j.getLostPoint(this);if(0==d||a>b)a=b,c=d}return c},createMovieClip:function(a,c,d){a=a.createEmptyMovieClip(c,d);this.make();for(c=0;c=f;f++)for(var i=-2;2>=i;i++)this.modules[b+f][e+i]=-2==f||2==f||-2==i||2==i||0==f&&0==i?!0:!1}},setupTypeNumber:function(a){for(var c= +j.getBCHTypeNumber(this.typeNumber),d=0;18>d;d++){var b=!a&&1==(c>>d&1);this.modules[Math.floor(d/3)][d%3+this.moduleCount-8-3]=b}for(d=0;18>d;d++)b=!a&&1==(c>>d&1),this.modules[d%3+this.moduleCount-8-3][Math.floor(d/3)]=b},setupTypeInfo:function(a,c){for(var d=j.getBCHTypeInfo(this.errorCorrectLevel<<3|c),b=0;15>b;b++){var e=!a&&1==(d>>b&1);6>b?this.modules[b][8]=e:8>b?this.modules[b+1][8]=e:this.modules[this.moduleCount-15+b][8]=e}for(b=0;15>b;b++)e=!a&&1==(d>>b&1),8>b?this.modules[8][this.moduleCount- +b-1]=e:9>b?this.modules[8][15-b-1+1]=e:this.modules[8][15-b-1]=e;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,c){for(var d=-1,b=this.moduleCount-1,e=7,f=0,i=this.moduleCount-1;0g;g++)if(null==this.modules[b][i-g]){var n=!1;f>>e&1));j.getMask(c,b,i-g)&&(n=!n);this.modules[b][i-g]=n;e--; -1==e&&(f++,e=7)}b+=d;if(0>b||this.moduleCount<=b){b-=d;d=-d;break}}}};o.PAD0=236;o.PAD1=17;o.createData=function(a,c,d){for(var c=p.getRSBlocks(a, +c),b=new t,e=0;e8*a)throw Error("code length overflow. ("+b.getLengthInBits()+">"+8*a+")");for(b.getLengthInBits()+4<=8*a&&b.put(0,4);0!=b.getLengthInBits()%8;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*a);){b.put(o.PAD0,8);if(b.getLengthInBits()>=8*a)break;b.put(o.PAD1,8)}return o.createBytes(b,c)};o.createBytes=function(a,c){for(var d= +0,b=0,e=0,f=Array(c.length),i=Array(c.length),g=0;g>>=1;return c},getPatternPosition:function(a){return j.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,d){switch(a){case 0:return 0==(c+d)%2;case 1:return 0==c%2;case 2:return 0==d%3;case 3:return 0==(c+d)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(d/3))%2;case 5:return 0==c*d%2+c*d%3;case 6:return 0==(c*d%2+c*d%3)%2;case 7:return 0==(c*d%3+(c+d)%2)%2;default:throw Error("bad maskPattern:"+ +a);}},getErrorCorrectPolynomial:function(a){for(var c=new q([1],0),d=0;dc)switch(a){case 1:return 10;case 2:return 9;case s:return 8;case 8:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case 1:return 12;case 2:return 11;case s:return 16;case 8:return 10;default:throw Error("mode:"+a);}else if(41>c)switch(a){case 1:return 14;case 2:return 13;case s:return 16;case 8:return 12;default:throw Error("mode:"+ +a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),d=0,b=0;b=g;g++)if(!(0>b+g||c<=b+g))for(var h=-1;1>=h;h++)0>e+h||c<=e+h||0==g&&0==h||i==a.isDark(b+g,e+h)&&f++;5a)throw Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:Array(256), +LOG_TABLE:Array(256)},m=0;8>m;m++)l.EXP_TABLE[m]=1<m;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(m=0;255>m;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;q.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=Array(this.getLength()+a.getLength()-1),d=0;d +this.getLength()-a.getLength())return this;for(var c=l.glog(this.get(0))-l.glog(a.get(0)),d=Array(this.getLength()),b=0;b>>7-a%8&1)},put:function(a,c){for(var d=0;d>>c-d-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};"string"===typeof h&&(h={text:h});h=r.extend({},{render:"canvas",width:256,height:256,typeNumber:-1, +correctLevel:2,background:"#ffffff",foreground:"#000000"},h);return this.each(function(){var a;if("canvas"==h.render){a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();var c=document.createElement("canvas");c.width=h.width;c.height=h.height;for(var d=c.getContext("2d"),b=h.width/a.getModuleCount(),e=h.height/a.getModuleCount(),f=0;f").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background);d=h.width/a.getModuleCount();b=h.height/a.getModuleCount();for(e=0;e").css("height",b+"px").appendTo(c);for(i=0;i").css("width", +d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo(f)}}a=c;jQuery(a).appendTo(this)})}})(jQuery); diff --git a/public/assets/js/require-backend.js b/public/assets/js/require-backend.js index 4a2bfc4..4f1e2c0 100644 --- a/public/assets/js/require-backend.js +++ b/public/assets/js/require-backend.js @@ -50,7 +50,7 @@ require.config({ 'template': '../libs/art-template/dist/template-native', 'selectpage': '../libs/fastadmin-selectpage/selectpage', 'citypicker': '../libs/fastadmin-citypicker/dist/js/city-picker.min', - 'citypicker-data': '../libs/fastadmin-citypicker/dist/js/city-picker.data', + 'citypicker-data': '../libs/fastadmin-citypicker/dist/js/city-picker.data' }, // shim依赖配置 shim: { diff --git a/route/app.php b/route/app.php new file mode 100644 index 0000000..7c9a446 --- /dev/null +++ b/route/app.php @@ -0,0 +1,7 @@ +