|
@@ -3,12 +3,6 @@
|
|
namespace app\index\controller;
|
|
namespace app\index\controller;
|
|
|
|
|
|
use app\common\controller\Frontend;
|
|
use app\common\controller\Frontend;
|
|
-use app\common\model\pig\Code;
|
|
|
|
-use app\common\model\pig\Company;
|
|
|
|
-use app\common\model\pig\Order;
|
|
|
|
-use think\Cache;
|
|
|
|
-
|
|
|
|
-//use think\Cookie;
|
|
|
|
|
|
|
|
class Index extends Frontend
|
|
class Index extends Frontend
|
|
{
|
|
{
|
|
@@ -21,106 +15,4 @@ class Index extends Frontend
|
|
{
|
|
{
|
|
return $this->view->fetch();
|
|
return $this->view->fetch();
|
|
}
|
|
}
|
|
-
|
|
|
|
- //溯源码
|
|
|
|
- public function code()
|
|
|
|
- {
|
|
|
|
- //echo encrypt(str_pad(2, 6, '0', STR_PAD_LEFT));exit;
|
|
|
|
- //用cookies 做核验校验
|
|
|
|
- $code = $this->request->request('id');
|
|
|
|
- if (!$code) {
|
|
|
|
- $this->error("CODE为空,非法访问!");
|
|
|
|
- exit;
|
|
|
|
- }
|
|
|
|
- $id = intval(decrypt($code));
|
|
|
|
- if (!$id) {
|
|
|
|
- $this->error("参数错误!!");
|
|
|
|
- }
|
|
|
|
- //$id = 1;
|
|
|
|
- echo $id;
|
|
|
|
- $code = new Code();
|
|
|
|
- $codeinfo = $code->find($id);
|
|
|
|
- if (!$codeinfo) {
|
|
|
|
- $this->error("参数错误!");
|
|
|
|
- exit;
|
|
|
|
- }
|
|
|
|
- $orderid = $codeinfo['orderid'];
|
|
|
|
- echo $orderid;
|
|
|
|
-
|
|
|
|
- if (!$orderid) {
|
|
|
|
- $this->error("参数错误~");
|
|
|
|
- exit;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $key = md5($orderid.'code');
|
|
|
|
- $info = Cache::get($key);
|
|
|
|
- if (!$info) {
|
|
|
|
- $order = new Order();
|
|
|
|
- $orderinfo = $order->where('orderid', $orderid)->find();
|
|
|
|
- $orderinfo['text'] = 'sss';
|
|
|
|
- $info['orderinfo'] = $orderinfo;
|
|
|
|
-
|
|
|
|
- $company = new Company();
|
|
|
|
- $companyinfo = $company->where('admin_id', $orderinfo['admin_id'])->where('type', 3)->find();
|
|
|
|
- $this->companyinfo($companyinfo);
|
|
|
|
- $companyinfo['idcode'] = encrypt(str_pad($companyinfo['id'], 6, '0', STR_PAD_LEFT));
|
|
|
|
- $info['companyinfo'] = $companyinfo;
|
|
|
|
-
|
|
|
|
- $supplier = $company->find($orderinfo['supplier_id']);
|
|
|
|
- $info['supplier'] = $supplier;
|
|
|
|
-
|
|
|
|
- $customer = $company->find($orderinfo['customer_id']);
|
|
|
|
- $info['customer'] = $customer;
|
|
|
|
-
|
|
|
|
- Cache::set($key, $info, 60);//一小时缓存
|
|
|
|
- }
|
|
|
|
- print_r($info);
|
|
|
|
-
|
|
|
|
- $this->view->assign('orderinfo', $info['orderinfo']);
|
|
|
|
- $this->view->assign('companyinfo', $info['companyinfo']);
|
|
|
|
- $this->view->assign('supplier', $info['supplier']);
|
|
|
|
- $this->view->assign('customer', $info['customer']);
|
|
|
|
- return $this->view->fetch();
|
|
|
|
- }
|
|
|
|
- //公司详情
|
|
|
|
- public function company()
|
|
|
|
- {
|
|
|
|
- $id = $code = $this->request->request('id');
|
|
|
|
- if (!$id) {
|
|
|
|
- $this->error("ID为空,非法访问!");
|
|
|
|
- exit;
|
|
|
|
- }
|
|
|
|
- $id = intval(decrypt($id));
|
|
|
|
- if (!$id) {
|
|
|
|
- $this->error("参数错误!!");
|
|
|
|
- exit;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $company = new Company();
|
|
|
|
- $companyinfo = $company->find($id);
|
|
|
|
- if (!$companyinfo) {
|
|
|
|
- $this->error("参数错误,非法访问!");
|
|
|
|
- exit;
|
|
|
|
- }
|
|
|
|
- $this->companyinfo($companyinfo);
|
|
|
|
-
|
|
|
|
- $this->view->assign('companyinfo', $companyinfo);
|
|
|
|
- return $this->view->fetch();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private function companyinfo(&$companyinfo)
|
|
|
|
- {
|
|
|
|
- if ($companyinfo['images']) {
|
|
|
|
- $arr = explode(',', $companyinfo['images']);
|
|
|
|
- } else {
|
|
|
|
- $arr[] = '/assets/code/zzry1.jpg';
|
|
|
|
- }
|
|
|
|
- $companyinfo['imgs'] = $arr;
|
|
|
|
- if ($companyinfo['banner_images']) {
|
|
|
|
- $banners = explode(',', $companyinfo['banner_images']);
|
|
|
|
- $companyinfo['banners'] = $banners[0];
|
|
|
|
- } else {
|
|
|
|
- $companyinfo['banners'] = '/assets/code/banner1.jpg';
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|