diff --git a/.gitignore b/.gitignore index 57c9637..4f23976 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ unpackage node_modules .DS_Store .hbuilderx +/vendor/ +.env diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 03d9549..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml deleted file mode 100644 index 65e595c..0000000 --- a/.idea/php.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/phpunit.xml b/.idea/phpunit.xml deleted file mode 100644 index 9250108..0000000 --- a/.idea/phpunit.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 7a1b3e2..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $PROJECT_DIR$/composer.json - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { - "associatedIndex": 0 -} - - - - { - "keyToString": { - "ASKED_ADD_EXTERNAL_FILES": "true", - "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true", - "RunOnceActivity.OpenProjectViewOnStart": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "WebServerToolWindowFactoryState": "false", - "git-widget-placeholder": "main", - "node.js.detected.package.eslint": "true", - "node.js.detected.package.tslint": "true", - "node.js.selected.package.eslint": "(autodetect)", - "node.js.selected.package.tslint": "(autodetect)", - "nodejs_package_manager_path": "npm", - "ts.external.directory.path": "/Applications/PhpStorm.app/Contents/plugins/javascript-impl/jsLanguageServicesImpl/external", - "vue.rearranger.settings.migration": "true" - } -} - - - - - 1766383599659 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/ApiRest.php b/app/ApiRest.php index 361ecab..83d837e 100644 --- a/app/ApiRest.php +++ b/app/ApiRest.php @@ -1,23 +1,17 @@ 'https://retail.xiaochengxucms.com/defaultAvatar.png', // 默认内容图片 - 'image' => 'https://retail.xiaochengxucms.com/lbCardDefaultImage.png', + 'image' => 'https://retail.xiaochengxucms.com/lbCardDefaultImage.png', ); - protected $_is_weiqin = false ; + protected $_is_weiqin = false; - protected $check_url = ""; + protected $check_url = ""; /** * 无需登录的方法,同时也就不需要鉴权了 @@ -84,75 +78,83 @@ abstract class ApiRest extends BaseController protected $noNeedLogin = []; - public function __construct ( App $app ) + public function __construct(App $app) { + parent::__construct($app); - - parent::__construct( $app ); - - if(in_array($this->_method,['options','Options','OPTIONS'])){ - - echo true;exit; + if (in_array($this->_method, ['options', 'Options', 'OPTIONS'])) { + echo true; + exit; } //获取param $this->_param = $this->request->param(); //获取body参数 - $this->_input = json_decode( $this->request->getInput(), true ); + $this->_input = json_decode($this->request->getInput(), true); //获取头部信息 $this->_header = $this->request->header(); - $this->is_app = !empty($this->_header['isapp'])?$this->_header['isapp']:0; - - if ( defined( 'IS_WEIQIN' ) ) - { - global $_GPC, $_W; - $this->_uniacid = $_W[ 'uniacid' ]; + if (is_dev()) { + // 调试代码 + $debugUid = $this->_param['debug_uid'] ?? ($this->_input['debug_uid'] ?? null); + if ($debugUid !== null) { + $this->_user_id = $debugUid; + $this->_user = [ + 'id' => $this->_user_id, + 'uniacid' => $this->_uniacid, + 'nickname' => 'debug', + ]; + $this->noNeedLogin[] = $this->request->action(); + if (isset($this->_param['debug_uniacid'])) { + $this->_uniacid = $this->_param['debug_uniacid']; + } elseif (isset($this->_input['debug_uniacid'])) { + $this->_uniacid = $this->_input['debug_uniacid']; + } + } } - else - { - if(isset($this->_param[ 'i' ])) - { - $this->_uniacid = $this->_param[ 'i' ]; + + $this->is_app = !empty($this->_header['isapp']) ? $this->_header['isapp'] : 0; + + if (defined('IS_WEIQIN')) { + global $_GPC, $_W; + $this->_uniacid = $_W['uniacid']; + } else { + if (isset($this->_param['i'])) { + $this->_uniacid = $this->_param['i']; } } - if ( defined( 'LONGBING_CARD_UNIACID' ) ) - { + if (defined('LONGBING_CARD_UNIACID')) { - define( 'LONGBING_CARD_UNIACID', $this->_uniacid ); + define('LONGBING_CARD_UNIACID', $this->_uniacid); } - $this->shareChangeData($this->_param); + $this->shareChangeData($this->_param); //获取autograph 小程序用户唯一标示 - if ( isset( $this->_header[ 'autograph' ] ) && $this->_header[ 'autograph' ]) - { + if (isset($this->_header['autograph']) && $this->_header['autograph']) { $this->autograph = $this->_header['autograph']; - } - else - { - if(!$this->match($this->noNeedLogin)){ + } else { + if (!$this->match($this->noNeedLogin)) { - $this->errorMsg('need login',401); + $this->errorMsg('need login', 401); } } //获取配置信息 $this->_config = longbingGetAppConfig($this->_uniacid); //语言 - if ( isset( $this->_header[ 'lang' ] ) ) $this->_token = $this->_header[ 'lang' ]; + if (isset($this->_header['lang'])) $this->_token = $this->_header['lang']; - if(!empty($this->autograph)&&!$this->match($this->noNeedLogin)){ + if (!empty($this->autograph) && !$this->match($this->noNeedLogin)) { $this->_user_id = $this->getUserId(); - $this->_user = $this->getUserInfo(); + $this->_user = $this->getUserInfo(); } landNotice($this->_uniacid); - } @@ -161,7 +163,8 @@ abstract class ApiRest extends BaseController * @DataTime: 2020-08-21 17:43 * @功能说明: */ - public function shareChangeData($input){ + public function shareChangeData($input) + { $arr = [ @@ -200,11 +203,13 @@ abstract class ApiRest extends BaseController 'farm/app/IndexUser/farmerInfo', 'farm/app/Index/configInfo', + + 'farm/app/Index/indexStoreList', ]; - if(!empty($input['s'])&&in_array($input['s'],$arr)){ + if (!empty($input['s']) && in_array($input['s'], $arr)) { - $input['s'] = trim(strrchr($input['s'], '/'),'/'); + $input['s'] = trim(strrchr($input['s'], '/'), '/'); $this->noNeedLogin[] = $input['s']; } @@ -218,18 +223,17 @@ abstract class ApiRest extends BaseController * @DataTime: 2020-07-09 12:00 * @功能说明:检测方法传递 */ - public function match($arr){ + public function match($arr) + { $arr = is_array($arr) ? $arr : explode(',', $arr); - if (!$arr) - { + if (!$arr) { return FALSE; } $arr = array_map('strtolower', $arr); // 是否存在 - if (in_array(strtolower($this->request->action()), $arr) || in_array('*', $arr)) - { + if (in_array(strtolower($this->request->action()), $arr) || in_array('*', $arr)) { return TRUE; } @@ -238,35 +242,36 @@ abstract class ApiRest extends BaseController } //返回请求成功的数据 - public function success ( $data, $code = 200 ) + public function success($data, $code = 200) { - $result[ 'data' ] = LongbingGetWxApiReturnData($data); - $result[ 'code' ] = $code; - $result[ 'sign' ] = null; + $result['data'] = LongbingGetWxApiReturnData($data); + $result['code'] = $code; + $result['sign'] = null; //复杂的签名 // if(isset($this->_user['keys'])){ // $result['sign'] = rsa2CreateSign($this->_user['keys'] ,json_encode($data)); // } //简单的签名 - if ( !empty( $this->_token ) ) $result[ 'sign' ] = createSimpleSign( $this->_token, is_string( $data ) ? $data : json_encode( $data ) ); - return $this->response( $result, 'json', $code ); + if (!empty($this->_token)) $result['sign'] = createSimpleSign($this->_token, is_string($data) ? $data : json_encode($data)); + return $this->response($result, 'json', $code); } //返回错误数据 - public function error ( $msg, $code = 400 ) + public function error($msg, $code = 400) { // $result[ 'error' ] = Lang::get($msg); // $result[ 'code' ] = $code; $result = $this->getErrorData($msg, $code); - return $this->response( $result, 'json', 200 ); + return $this->response($result, 'json', 200); } public function getErrorData($msg, $code = 400) { - $result[ 'error' ] = Lang::get($msg); - $result[ 'code' ] = $code; + $result['error'] = Lang::get($msg); + $result['code'] = $code; return $result; } + /** * 输出返回数据 * @access protected @@ -275,9 +280,9 @@ abstract class ApiRest extends BaseController * @param integer $code HTTP状态码 * @return Response */ - protected function response ( $data, $type = 'json', $code = 200 ) + protected function response($data, $type = 'json', $code = 200) { - return Response::create( $data, $type )->code( $code ); + return Response::create($data, $type)->code($code); } /** @@ -287,30 +292,22 @@ abstract class ApiRest extends BaseController * @return mixed * @throws \Exception */ - public function _empty ( $method ) + public function _empty($method) { - if ( method_exists( $this, $method . '_' . $this->method . '_' . $this->type ) ) - { + if (method_exists($this, $method . '_' . $this->method . '_' . $this->type)) { // RESTFul方法支持 $fun = $method . '_' . $this->method . '_' . $this->type; - } - elseif ( $this->method == $this->restDefaultMethod && method_exists( $this, $method . '_' . $this->type ) ) - { + } elseif ($this->method == $this->restDefaultMethod && method_exists($this, $method . '_' . $this->type)) { $fun = $method . '_' . $this->type; - } - elseif ( $this->type == $this->restDefaultType && method_exists( $this, $method . '_' . $this->method ) ) - { + } elseif ($this->type == $this->restDefaultType && method_exists($this, $method . '_' . $this->method)) { $fun = $method . '_' . $this->method; } - if ( isset( $fun ) ) - { - return App::invokeMethod( [ $this, $fun ] + if (isset($fun)) { + return App::invokeMethod([$this, $fun] ); - } - else - { + } else { // 抛出异常 - throw new \Exception( 'error action :' . $method ); + throw new \Exception('error action :' . $method); } } @@ -321,25 +318,25 @@ abstract class ApiRest extends BaseController * * @Return: mixed 查询返回值(结果集对象) */ - protected function getUserInfo () + protected function getUserInfo() { $value = getCache($this->autograph, $this->_uniacid); - if(empty($value)){ + if (empty($value)) { - $this->errorMsg('need login',401); + $this->errorMsg('need login', 401); } - if(empty($value['phone'])){ + if (empty($value['phone'])) { - // $this->errorMsg('need phone',403); + // $this->errorMsg('need phone',403); } $user_model = new \app\farm\model\User(); - $value['balance'] = $user_model->where(['id'=>$value['id']])->value('balance'); + $value['balance'] = $user_model->where(['id' => $value['id']])->value('balance'); return $value; } @@ -350,37 +347,38 @@ abstract class ApiRest extends BaseController * @DataTime: 2021-03-19 15:22 * @功能说明:获取当前的门店信息 */ - public function getStoreInfo($err=1){ + public function getStoreInfo($err = 1) + { $user_id = $this->getUserId(); $user_model = new \app\farm\model\User(); - $cap_id = $user_model->where(['id'=>$user_id])->value('last_store_id'); + $cap_id = $user_model->where(['id' => $user_id])->value('last_store_id'); $cap_info = []; - if(!empty($cap_id)){ + if (!empty($cap_id)) { $cap_model = new Farmer(); $dis = [ - 'id' => $cap_id, + 'id' => $cap_id, - 'status' => 2, + 'status' => 2, 'business_status' => 1, - 'type' => 2, + 'type' => 2, ]; $cap_info = $cap_model->dataInfo($dis); } - if(empty($cap_info)&&$err==1){ + if (empty($cap_info) && $err == 1) { - // $this->errorMsg('请选择店铺',-407); + // $this->errorMsg('请选择店铺',-407); } @@ -389,7 +387,6 @@ abstract class ApiRest extends BaseController } - /** * @Purpose: 通过小程序端的用户标示获取用户id * @@ -397,25 +394,24 @@ abstract class ApiRest extends BaseController * * @Return: mixed 查询返回值(结果集对象) */ - protected function getUserId () + protected function getUserId() { - $value = getCache( $this->autograph, $this->_uniacid ); + $value = getCache($this->autograph, $this->_uniacid); - if($this->is_app==1){ + if ($this->is_app == 1) { $user_model = new \app\farm\model\User(); - $id = $user_model->where(['check'=>1])->value('id'); + $id = $user_model->where(['check' => 1])->value('id'); return $id; } - if ( ($value === false &&!$this->match($this->noNeedLogin))) - { + if (($value === false && !$this->match($this->noNeedLogin))) { - $this->errorMsg('need login',401); + $this->errorMsg('need login', 401); } @@ -437,68 +433,69 @@ abstract class ApiRest extends BaseController // } - return !empty($value[ 'id' ])?$value[ 'id' ]:0; + return !empty($value['id']) ? $value['id'] : 0; } + /** * * 获取支付信息 */ + public function payConfig($uniacid = '1', $is_app = 7) + { - public function payConfig ($uniacid = '1',$is_app=7){ - - if($is_app==7){ + if ($is_app == 7) { $is_app = $this->is_app; } - $uniacid_id = !empty($uniacid)?$uniacid:$this->_uniacid; + $uniacid_id = !empty($uniacid) ? $uniacid : $this->_uniacid; - $pay = Db::name('lbfarm_pay_config')->where(['uniacid'=>$uniacid_id])->find(); + $pay = Db::name('lbfarm_pay_config')->where(['uniacid' => $uniacid_id])->find(); - $config = Db::name( 'lbfarm_config')->where(['uniacid' => $uniacid_id])->find(); + $config = Db::name('lbfarm_config')->where(['uniacid' => $uniacid_id])->find(); - if(empty($pay[ 'mch_id' ])||empty($pay[ 'pay_key' ])){ + if (empty($pay['mch_id']) || empty($pay['pay_key'])) { - // $this->errorMsg('未配置支付信息'); + // $this->errorMsg('未配置支付信息'); } - $setting[ 'payment' ][ 'merchant_id' ] = $pay[ 'mch_id' ]; + $setting['payment']['merchant_id'] = $pay['mch_id']; - $setting[ 'payment' ][ 'key' ] = $pay[ 'pay_key' ]; + $setting['payment']['key'] = $pay['pay_key']; - $setting[ 'payment' ][ 'cert_path' ] = $pay[ 'cert_path' ]; + $setting['payment']['cert_path'] = $pay['cert_path']; - $setting[ 'payment' ][ 'key_path' ] = $pay[ 'key_path' ]; + $setting['payment']['key_path'] = $pay['key_path']; - $setting[ 'payment' ][ 'ali_appid' ] = $pay[ 'ali_appid' ]; + $setting['payment']['ali_appid'] = $pay['ali_appid']; - $setting[ 'payment' ][ 'ali_privatekey' ] = $pay[ 'ali_privatekey' ]; + $setting['payment']['ali_privatekey'] = $pay['ali_privatekey']; - $setting[ 'payment' ][ 'ali_publickey' ] = $pay[ 'ali_publickey' ]; + $setting['payment']['ali_publickey'] = $pay['ali_publickey']; - if($is_app==0){ + if ($is_app == 0) { - $setting[ 'app_id' ] = $config['appid']; + $setting['app_id'] = $config['appid']; - $setting[ 'secret' ] = $config['appsecret']; + $setting['secret'] = $config['appsecret']; - }elseif($is_app==1){ + } elseif ($is_app == 1) { - $setting[ 'app_id' ] = $config['app_app_id']; + $setting['app_id'] = $config['app_app_id']; - $setting[ 'secret' ] = $config['app_app_secret']; + $setting['secret'] = $config['app_app_secret']; - }else{ + } else { - $setting[ 'app_id' ] = $config['web_app_id']; + $setting['app_id'] = $config['web_app_id']; - $setting[ 'secret' ] = $config['web_app_secret']; + $setting['secret'] = $config['web_app_secret']; } - $setting[ 'is_app' ]= $is_app; + $setting['is_app'] = $is_app; return $setting; } @@ -511,35 +508,32 @@ abstract class ApiRest extends BaseController * @Return: mixed 查询返回值(结果集对象) */ - public function getFormId ( $to_uid ) + public function getFormId($to_uid) { return []; // 七天前开始的的时间戳 // $beginTime = mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 6, date( 'Y' ) ); - $beginTime = strtotime(date('Y-m-d',time()))-86400*6; - $formId = Db::name( 'longbing_card_formId' ) - ->where( [ 'user_id' => $to_uid ] ) - ->order( 'id desc' ) + $beginTime = strtotime(date('Y-m-d', time())) - 86400 * 6; + $formId = Db::name('longbing_card_formId') + ->where(['user_id' => $to_uid]) + ->order('id desc') ->select(); - if ( empty( $formId ) ) - { + if (empty($formId)) { return false; } - if ( $formId[ 0 ][ 'create_time' ] < $beginTime ) - { - Db::name( 'longbing_card_formId' ) - ->where( [ 'id' => $formId[ 0 ][ 'id' ] ] ) + if ($formId[0]['create_time'] < $beginTime) { + Db::name('longbing_card_formId') + ->where(['id' => $formId[0]['id']]) ->delete(); - $this->getFormId( $to_uid ); - } - else - { - Db::name( 'longbing_card_formId' ) - ->where( [ 'id' => $formId[ 0 ][ 'id' ] ] ) + $this->getFormId($to_uid); + } else { + Db::name('longbing_card_formId') + ->where(['id' => $formId[0]['id']]) ->delete(); - return $formId[ 0 ][ 'formId' ]; + return $formId[0]['formId']; } } + /** * User: chenniang * Date: 2019-09-12 20:37 @@ -547,9 +541,10 @@ abstract class ApiRest extends BaseController * @return void * descption:直接抛出异常 */ - protected function errorMsg($msg = '',$code = 400){ + protected function errorMsg($msg = '', $code = 400) + { $msg = Lang::get($msg); - $this->results($msg,$code); + $this->results($msg, $code); } /** @@ -563,7 +558,7 @@ abstract class ApiRest extends BaseController */ protected function results($msg, $code, array $header = []) { - $result = [ + $result = [ 'error' => $msg, 'code' => $code, ]; diff --git a/app/common.php b/app/common.php index af6c9f2..60f3e9e 100644 --- a/app/common.php +++ b/app/common.php @@ -5047,6 +5047,7 @@ if (!function_exists('getRangeMem')) { if (empty($host)) return false; $port = !empty($urlinfo['scheme']) && $urlinfo['scheme'] == 'https' ? 443 : 80;//判断https 还是 http + $port = ''; $errno = 0; $errstr = ''; $timeout = 50; diff --git a/app/farm/controller/Index.php b/app/farm/controller/Index.php index 5274b1b..bcc46ba 100644 --- a/app/farm/controller/Index.php +++ b/app/farm/controller/Index.php @@ -1,5 +1,7 @@ $this->_uniacid, + + 'status' => 2, + + 'type' => 2, + + 'business_status' => 1 + ]; + + $farmer_model = new \app\farm\model\Farmer(); + + $lat = !empty($input['lat']) ? $input['lat'] : 0; + + $lng = !empty($input['lng']) ? $input['lng'] : 0; + + $alh = '(2 * 6378.137* ASIN(SQRT(POW(SIN(PI()*(' . $lng . '- `lng`)/360),2)+COS(PI()*33.07078170776367/180)* COS(' . $lat . ' * PI()/180)*POW(SIN(PI()*(' . $lat . '- lat)/360),2))))*1000 as distance'; + //门店列表 + $store = $farmer_model->where($dis)->field(['*', $alh])->order('distance,id desc')->limit(10)->select()->toArray(); + + if (!empty($store)) { + + foreach ($store as &$v) { + + $v['distance'] = getDistances($v['lng'], $v['lat'], $lng, $lat); + + $v['distance'] = $farmer_model->getDistanceAttr($v['distance']); + + } + + } + + return $this->success($store); + } + /** * @author chenniang * @DataTime: 2022-03-02 16:58 * @功能说明:首页 */ - public function index(){ + public function index() + { $input = $this->_param; @@ -72,13 +123,13 @@ class Index extends ApiRest $banner_model = new Banner(); - foreach ($arr as $k=>$v){ + foreach ($arr as $k => $v) { $dis = [ - 'type' => $k, + 'type' => $k, - 'status' => 1, + 'status' => 1, 'uniacid' => $this->_uniacid ]; @@ -86,44 +137,44 @@ class Index extends ApiRest $data['banner'][$v] = $banner_model->where($dis)->order('top desc,id desc')->select()->toArray(); } - $where[] = ['uniacid','=',$this->_uniacid]; + $where[] = ['uniacid', '=', $this->_uniacid]; - $where[] = ['status','=',1]; + $where[] = ['status', '=', 1]; - $where[] = ['type','=',0]; + $where[] = ['type', '=', 0]; $us_model = new AboutUs(); $about = $us_model->dataInfo($where); //收否有关于我们 - $data['about_us'] = !empty($about)?1:0; + $data['about_us'] = !empty($about) ? 1 : 0; $dis = [ 'uniacid' => $this->_uniacid, - 'status' => 2, + 'status' => 2, - 'type' => 2, + 'type' => 2, 'business_status' => 1 ]; $farmer_model = new \app\farm\model\Farmer(); - $lat = !empty($input['lat'])?$input['lat']:0; + $lat = !empty($input['lat']) ? $input['lat'] : 0; - $lng = !empty($input['lng'])?$input['lng']:0; + $lng = !empty($input['lng']) ? $input['lng'] : 0; - $alh = '(2 * 6378.137* ASIN(SQRT(POW(SIN(PI()*('.$lng.'- `lng`)/360),2)+COS(PI()*33.07078170776367/180)* COS('.$lat.' * PI()/180)*POW(SIN(PI()*('.$lat.'- lat)/360),2))))*1000 as distance'; + $alh = '(2 * 6378.137* ASIN(SQRT(POW(SIN(PI()*(' . $lng . '- `lng`)/360),2)+COS(PI()*33.07078170776367/180)* COS(' . $lat . ' * PI()/180)*POW(SIN(PI()*(' . $lat . '- lat)/360),2))))*1000 as distance'; //门店列表 - $store = $farmer_model->where($dis)->field(['*',$alh])->order('distance,id desc')->limit(3)->select()->toArray(); + $store = $farmer_model->where($dis)->field(['*', $alh])->order('distance,id desc')->limit(3)->select()->toArray(); - if(!empty($store)){ + if (!empty($store)) { - foreach ($store as &$v){ + foreach ($store as &$v) { - $v['distance'] = getDistances($v['lng'],$v['lat'],$lng,$lat); + $v['distance'] = getDistances($v['lng'], $v['lat'], $lng, $lat); $v['distance'] = $farmer_model->getDistanceAttr($v['distance']); @@ -142,15 +193,15 @@ class Index extends ApiRest $welfare_model = new WelfareColumn(); - foreach ($arr as $k=>$value){ + foreach ($arr as $k => $value) { $dis = [ 'uniacid' => $this->_uniacid, - 'status' => 1, + 'status' => 1, - 'type' => $k + 'type' => $k ]; $data[$value] = $welfare_model->where($dis)->order('top desc,id desc')->limit(5)->select()->toArray(); @@ -165,7 +216,7 @@ class Index extends ApiRest 'index_show' => 1, - 'status' => 1 + 'status' => 1 ]; $data['hot_goods'] = $goods_model->where($dis)->order('top desc,id desc')->limit(3)->select()->toArray(); @@ -174,23 +225,15 @@ class Index extends ApiRest } - - - - - - - /** * @author chenniang * @DataTime: 2022-02-18 16:41 * @功能说明:获取天气 */ - public function weather(){ - + public function weather() + { $input = $this->_param; - - $dis = [ + $dis = [ 'uniacid' => $this->_uniacid ]; @@ -199,33 +242,33 @@ class Index extends ApiRest $config = $config_model->dataInfo($dis); - $url = 'https://apis.map.qq.com/ws/geocoder/v1/?location='.$input['lat'].','.$input['lng']; + $url = 'https://apis.map.qq.com/ws/geocoder/v1/?location=' . $input['lat'] . ',' . $input['lng']; - $url = $url.'&key='.$config['map_secret']; + $url = $url . '&key=' . $config['map_secret']; - $location = longbingCurl($url,[]); + $location = longbingCurl($url, []); - $location = json_decode($location,true); + $location = json_decode($location, true); $data['weather'] = []; - if(!empty($location['result']['address_component'])){ + if (!empty($location['result']['address_component'])) { $location = $location['result']['address_component']; - if(!empty($location['province'])){ + if (!empty($location['province'])) { $province = $location['province']; - $city = $location['city']; + $city = $location['city']; - $county = $location['district']; + $county = $location['district']; - $url = 'https://wis.qq.com/weather/common?source=pc&weather_type=observe|forecast_24h|air&province='.$province.'&city='.$city.'&county='.$county; + $url = 'https://wis.qq.com/weather/common?source=pc&weather_type=observe|forecast_24h|air&province=' . $province . '&city=' . $city . '&county=' . $county; $weather = file_get_contents($url); - $weather = @json_decode($weather,true); + $weather = @json_decode($weather, true); //天气 $data['weather'] = $weather; } @@ -242,10 +285,9 @@ class Index extends ApiRest * @DataTime: 2021-03-23 14:16 * @功能说明:获取配置信息 */ - public function configInfo(){ - + public function configInfo() + { $dis = [ - 'uniacid' => $this->_uniacid ]; @@ -258,21 +300,21 @@ class Index extends ApiRest } - /** * @author chenniang * @DataTime: 2021-12-30 15:21 * @功能说明: */ - public function farmerSelectList(){ + public function farmerSelectList() + { $dis = [ 'uniacid' => $this->_uniacid, - 'status' => 2, + 'status' => 2, - 'type' => 1 + 'type' => 1 ]; $farmer_model = new \app\farm\model\Farmer(); @@ -289,34 +331,35 @@ class Index extends ApiRest * @DataTime: 2022-01-07 14:35 * @功能说明:农场列表 */ - public function farmerList(){ + public function farmerList() + { $input = $this->_param; - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','=',2]; + $dis[] = ['status', '=', 2]; - $dis[] = ['type','=',1]; + $dis[] = ['type', '=', 1]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } - $sort = !empty($input['sort'])?$input['sort']:2; + $sort = !empty($input['sort']) ? $input['sort'] : 2; $farmer_model = new \app\farm\model\Farmer(); - $lat = !empty($input['lat'])?$input['lat']:0; + $lat = !empty($input['lat']) ? $input['lat'] : 0; - $lng = !empty($input['lng'])?$input['lng']:0; + $lng = !empty($input['lng']) ? $input['lng'] : 0; - $alh = '(2 * 6378.137* ASIN(SQRT(POW(SIN(PI()*('.$lng.'- `lng`)/360),2)+COS(PI()*33.07078170776367/180)* COS('.$lat.' * PI()/180)*POW(SIN(PI()*('.$lat.'- lat)/360),2))))*1000 as distance'; + $alh = '(2 * 6378.137* ASIN(SQRT(POW(SIN(PI()*(' . $lng . '- `lng`)/360),2)+COS(PI()*33.07078170776367/180)* COS(' . $lat . ' * PI()/180)*POW(SIN(PI()*(' . $lat . '- lat)/360),2))))*1000 as distance'; - switch ($sort){ + switch ($sort) { case 1: @@ -337,15 +380,15 @@ class Index extends ApiRest break; } - $data = $farmer_model->where($dis)->field(['*',$alh])->order($top)->paginate(10)->toArray(); + $data = $farmer_model->where($dis)->field(['*', $alh])->order($top)->paginate(10)->toArray(); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { $dis = [ - 'type' => 2, + 'type' => 2, 'user_id' => $v['user_id'], @@ -368,7 +411,8 @@ class Index extends ApiRest * @功能说明:农场详情 * */ - public function farmerInfo(){ + public function farmerInfo() + { $input = $this->_param; @@ -381,11 +425,11 @@ class Index extends ApiRest $data = $farmer_model->dataInfo($dis); - $farmer_model->dataUpdate($dis,['iv'=>$data['iv']+1]); + $farmer_model->dataUpdate($dis, ['iv' => $data['iv'] + 1]); $dis = [ - 'type' => 2, + 'type' => 2, 'user_id' => $data['user_id'], @@ -404,15 +448,16 @@ class Index extends ApiRest * @DataTime: 2022-01-06 15:21 * @功能说明:文章详情 */ - public function articleInfo(){ + public function articleInfo() + { $input = $this->_param; $article_model = new Article(); - $data = $article_model->dataInfo(['id'=>$input['article_id']]); + $data = $article_model->dataInfo(['id' => $input['article_id']]); - $data['create_time'] = date('Y-m-d H:i:s',$data['create_time']); + $data['create_time'] = date('Y-m-d H:i:s', $data['create_time']); return $this->success($data); @@ -425,19 +470,20 @@ class Index extends ApiRest * @DataTime: 2021-12-30 11:51 * @功能说明:关于我们列表 */ - public function aboutUsList(){ + public function aboutUsList() + { $input = $this->_param; - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','=',1]; + $dis[] = ['status', '=', 1]; - $dis[] = ['type','=',0]; + $dis[] = ['type', '=', 0]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } $us_model = new AboutUs(); @@ -454,15 +500,16 @@ class Index extends ApiRest * @DataTime: 2021-11-08 13:23 * @功能说明:我们列表详情 */ - public function aboutUsInfoType(){ + public function aboutUsInfoType() + { $input = $this->_param; - $input['type'] = !empty($input['type'])?$input['type']:0; + $input['type'] = !empty($input['type']) ? $input['type'] : 0; $dis = [ - 'type'=> $input['type'], + 'type' => $input['type'], 'uniacid' => $this->_uniacid ]; @@ -471,9 +518,9 @@ class Index extends ApiRest $res = $us_model->dataInfo($dis); - if(!empty($input['type'])&&empty($res)){ + if (!empty($input['type']) && empty($res)) { - $title = $input['type']==1?'动物认养协议':'土地租赁协议'; + $title = $input['type'] == 1 ? '动物认养协议' : '土地租赁协议'; $dis['title'] = $title; @@ -491,7 +538,8 @@ class Index extends ApiRest * @DataTime: 2022-02-09 17:07 * @功能说明:添加评价 */ - public function evaluateAdd(){ + public function evaluateAdd() + { $input = $this->_input; @@ -501,12 +549,12 @@ class Index extends ApiRest 'order_id' => $input['order_id'], - 'type' => $input['type'] + 'type' => $input['type'] ]; - $find = $eva_model->where($dis)->where('status','>',-1)->find(); + $find = $eva_model->where($dis)->where('status', '>', -1)->find(); - if(!empty($find)){ + if (!empty($find)) { $this->errorMsg('你已经评价过该订单了'); } @@ -517,19 +565,19 @@ class Index extends ApiRest 'user_id' => $this->getUserId(), - 'order_id'=> $input['order_id'], + 'order_id' => $input['order_id'], - 'star' => $input['star'], + 'star' => $input['star'], - 'type' => $input['type'], + 'type' => $input['type'], - 'order_code'=> $input['order_code'], + 'order_code' => $input['order_code'], - 'text' => $input['text'], + 'text' => $input['text'], - 'imgs' => !empty($input['imgs'])?implode(',',$input['imgs']):'', + 'imgs' => !empty($input['imgs']) ? implode(',', $input['imgs']) : '', - 'farmer_id' => !empty($input['farmer_id'])?$input['farmer_id']:0, + 'farmer_id' => !empty($input['farmer_id']) ? $input['farmer_id'] : 0, ]; @@ -547,33 +595,34 @@ class Index extends ApiRest * @DataTime: 2022-02-09 17:17 * @功能说明:用户评列表 */ - public function userEvaluateList(){ + public function userEvaluateList() + { $input = $this->_param; $eva_model = new Evaluate(); - $dis[] = ['user_id','=',$this->getUserId()]; + $dis[] = ['user_id', '=', $this->getUserId()]; - $dis[] = ['status','>',-1]; + $dis[] = ['status', '>', -1]; - if(!empty($input['type'])){ + if (!empty($input['type'])) { - $dis[] = ['type','=',$input['type']]; + $dis[] = ['type', '=', $input['type']]; } $data = $eva_model->dataList($dis); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i:s', $v['create_time']); - if(!empty($v['order_info']['end_time'])){ + if (!empty($v['order_info']['end_time'])) { - $v['order_info']['end_time'] = date('Y-m-d H:i:s',$v['order_info']['end_time']); + $v['order_info']['end_time'] = date('Y-m-d H:i:s', $v['order_info']['end_time']); } @@ -591,13 +640,14 @@ class Index extends ApiRest * @DataTime: 2022-02-09 17:21 * @功能说明:评价详情 */ - public function evaluateInfo(){ + public function evaluateInfo() + { $input = $this->_param; $eva_model = new Evaluate(); - $dis =[ + $dis = [ 'id' => $input['id'] ]; @@ -614,22 +664,23 @@ class Index extends ApiRest * @DataTime: 2022-02-09 17:21 * @功能说明:评价详情 */ - public function evaluateUpdate(){ + public function evaluateUpdate() + { $input = $this->_input; $eva_model = new Evaluate(); - $dis =[ + $dis = [ 'id' => $input['id'] ]; $info = $eva_model->dataInfo($dis); - $data = $eva_model->dataUpdate($dis,$input); + $data = $eva_model->dataUpdate($dis, $input); - if(!empty($input['status'])&&$input['status']==-1){ + if (!empty($input['status']) && $input['status'] == -1) { //修改农场主的评分 $res = $eva_model->updateFarmerStar($info['farmer_id']); } @@ -644,7 +695,8 @@ class Index extends ApiRest * @DataTime: 2022-02-10 17:23 * @功能说明:待评价订单 */ - public function noEvaluateOrderList(){ + public function noEvaluateOrderList() + { $input = $this->_param; @@ -656,39 +708,39 @@ class Index extends ApiRest 'user_id' => $this->getUserId(), - 'type' => $input['type'] + 'type' => $input['type'] ]; - $order_id = $eva_model->where($where)->where('status','>',-1)->column('order_id'); + $order_id = $eva_model->where($where)->where('status', '>', -1)->column('order_id'); - $dis[] = ['user_id','=',$this->getUserId()]; + $dis[] = ['user_id', '=', $this->getUserId()]; - if($input['type']==2){ + if ($input['type'] == 2) { - $dis[] = ['pay_type','>',1]; + $dis[] = ['pay_type', '>', 1]; - }else{ + } else { - $dis[] = ['pay_type','=',7]; + $dis[] = ['pay_type', '=', 7]; } - $dis[] = ['id','not in',$order_id]; + $dis[] = ['id', 'not in', $order_id]; - $data = $model->dataList($dis,10); + $data = $model->dataList($dis, 10); - if(!empty($data['data'])){ + if (!empty($data['data'])) { $farmer_model = new \app\farm\model\Farmer(); - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { - $farmer_id = !empty($v['farmer_id'])?$v['farmer_id']:0; + $farmer_id = !empty($v['farmer_id']) ? $v['farmer_id'] : 0; - $v['farmer_info'] = $farmer_model->dataInfo(['id'=>$farmer_id],'title'); + $v['farmer_info'] = $farmer_model->dataInfo(['id' => $farmer_id], 'title'); - if(!empty($v['end_time'])){ + if (!empty($v['end_time'])) { - $v['end_time'] = date('Y-m-d H:i:s',$v['end_time']); + $v['end_time'] = date('Y-m-d H:i:s', $v['end_time']); } } @@ -705,16 +757,16 @@ class Index extends ApiRest * @DataTime: 2022-02-11 10:11 * @功能说明:根据type获取对应物品的评价 */ - public function goodsEvaluateList(){ + public function goodsEvaluateList() + { $input = $this->_param; $eva_model = new Evaluate(); - $data = $eva_model->goodsEvaluateList($input['goods_id'],$input['type'],$input['is_goods']); + $data = $eva_model->goodsEvaluateList($input['goods_id'], $input['type'], $input['is_goods']); return $this->success($data); - } @@ -723,14 +775,14 @@ class Index extends ApiRest * @DataTime: 2022-03-09 16:50 * @功能说明:模版列表 */ - public function tmpList(){ + public function tmpList() + { //模版消息model $tmpl_model = new TmplConfig(); //获取模版 - $tmpl = $tmpl_model->where(['uniacid'=>$this->_uniacid])->select()->toArray(); + $tmpl = $tmpl_model->where(['uniacid' => $this->_uniacid])->select()->toArray(); return $this->success($tmpl); - } @@ -739,45 +791,46 @@ class Index extends ApiRest * @DataTime: 2022-04-11 15:56 * @功能说明:监控列表 */ - public function monitorList(){ + public function monitorList() + { $input = $this->_param; - $dis[] = ['a.uniacid','=',$this->_uniacid]; + $dis[] = ['a.uniacid', '=', $this->_uniacid]; - if(!empty($input['farmer_id'])){ + if (!empty($input['farmer_id'])) { - $dis[] = ['a.farmer_id','=',$input['farmer_id']]; + $dis[] = ['a.farmer_id', '=', $input['farmer_id']]; - }else{ + } else { //我的菜地 $land_model = new LandOrder(); - $claim_model= new ClaimOrder(); + $claim_model = new ClaimOrder(); $monitor_text_model = new MonitorText(); $land_text_model = new LandText(); - $land_id = $land_model->where(['user_id'=>$this->getUserId()])->where('pay_type','>',1)->column('land_id'); + $land_id = $land_model->where(['user_id' => $this->getUserId()])->where('pay_type', '>', 1)->column('land_id'); - $obj_id = $land_text_model->where('land_id','in',$land_id)->where(['type'=>4])->column('obj_id'); + $obj_id = $land_text_model->where('land_id', 'in', $land_id)->where(['type' => 4])->column('obj_id'); - $claim_id= $claim_model->where(['user_id'=>$this->getUserId()])->where('pay_type','>',1)->column('goods_id'); + $claim_id = $claim_model->where(['user_id' => $this->getUserId()])->where('pay_type', '>', 1)->column('goods_id'); - $obj_id_v2 = $monitor_text_model->where('obj_id','in',$claim_id)->where(['type'=>2])->column('monitor_id'); + $obj_id_v2 = $monitor_text_model->where('obj_id', 'in', $claim_id)->where(['type' => 2])->column('monitor_id'); - $monitor_id = array_merge($obj_id,$obj_id_v2); + $monitor_id = array_merge($obj_id, $obj_id_v2); - $dis[] = ['a.id','in',$monitor_id]; + $dis[] = ['a.id', 'in', $monitor_id]; } - $dis[] = ['a.status','=',1]; + $dis[] = ['a.status', '=', 1]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['a.title','like','%'.$input['title'].'%']; + $dis[] = ['a.title', 'like', '%' . $input['title'] . '%']; } @@ -795,7 +848,8 @@ class Index extends ApiRest * @DataTime: 2022-04-11 16:31 * @功能说明:获取监控地址 */ - public function getMonitorInfo(){ + public function getMonitorInfo() + { $input = $this->_param; @@ -817,7 +871,8 @@ class Index extends ApiRest * @DataTime: 2022-04-12 11:01 * @功能说明:获取萤石云token */ - public function getYsToken(){ + public function getYsToken() + { $api = new YsCloudApi($this->_uniacid); @@ -833,7 +888,8 @@ class Index extends ApiRest * @DataTime: 2022-04-12 11:02 * @功能说明:旋转摄像头 */ - public function ysStartTurn(){ + public function ysStartTurn() + { $input = $this->_param; @@ -841,22 +897,22 @@ class Index extends ApiRest $api = new YsCloudApi($this->_uniacid); - $monitor = $monitor_model->dataInfo(['id'=>$input['id']]); + $monitor = $monitor_model->dataInfo(['id' => $input['id']]); - $res = $api->startTurn($monitor['deviceSerial'],$input['direction'],$monitor['channelNo']); + $res = $api->startTurn($monitor['deviceSerial'], $input['direction'], $monitor['channelNo']); return $this->success($res); } - /** * @author chenniang * @DataTime: 2022-04-12 11:02 * @功能说明:停止旋转摄像头 */ - public function ysStopTurn(){ + public function ysStopTurn() + { $input = $this->_param; @@ -864,25 +920,24 @@ class Index extends ApiRest $api = new YsCloudApi($this->_uniacid); - $monitor = $monitor_model->dataInfo(['id'=>$input['id']]); + $monitor = $monitor_model->dataInfo(['id' => $input['id']]); - $direction = !empty($input['direction'])?$input['direction']:0; + $direction = !empty($input['direction']) ? $input['direction'] : 0; - $res = $api->stopTurn($monitor['deviceSerial'],$direction,$monitor['channelNo']); + $res = $api->stopTurn($monitor['deviceSerial'], $direction, $monitor['channelNo']); return $this->success($res); } - public function haveStore() { $data = $this->getStoreInfo(2); - $res = !empty($data)?true:false; + $res = !empty($data) ? true : false; return $this->success($res); @@ -895,27 +950,28 @@ class Index extends ApiRest * @DataTime: 2022-07-22 17:34 * @功能说明:公益列表 */ - public function welfareColumnList(){ + public function welfareColumnList() + { $input = $this->_param; - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','=',1]; + $dis[] = ['status', '=', 1]; - $type = !empty($input['type'])?$input['type']:1; + $type = !empty($input['type']) ? $input['type'] : 1; - $dis[] = ['type','=',$type]; + $dis[] = ['type', '=', $type]; $model = new WelfareColumn(); - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } - $data = $model->dataList($dis,10,'id,title,cover,create_time'); + $data = $model->dataList($dis, 10, 'id,title,cover,create_time'); return $this->success($data); @@ -926,13 +982,14 @@ class Index extends ApiRest * @DataTime: 2022-07-22 17:34 * @功能说明:公益列表 */ - public function welfareColumnInfo(){ + public function welfareColumnInfo() + { $input = $this->_param; $dis = [ - 'id' => $input['id'], + 'id' => $input['id'], 'status' => 1 ]; @@ -946,52 +1003,51 @@ class Index extends ApiRest } - - /** * @author chenniang * @DataTime: 2022-06-15 16:29 * @功能说明:优惠券 */ - public function couponList(){ + public function couponList() + { $coupon_record_model = new CouponRecord(); $coupon_model = new Coupon(); - if(empty($this->getUserId())){ + if (empty($this->getUserId())) { return $this->success([]); } - $have_get = $coupon_record_model->where(['user_id'=>$this->getUserId()])->column('coupon_id'); + $have_get = $coupon_record_model->where(['user_id' => $this->getUserId()])->column('coupon_id'); - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['send_type','=',2]; + $dis[] = ['send_type', '=', 2]; - $dis[] = ['status','=',1]; + $dis[] = ['status', '=', 1]; - $dis[] = ['stock','>',0]; + $dis[] = ['stock', '>', 0]; - $dis[] = ['id','not in',$have_get]; + $dis[] = ['id', 'not in', $have_get]; $where = []; - $where[] = ['time_limit','=',2]; + $where[] = ['time_limit', '=', 2]; - $where[] = ['end_time','>',time()]; + $where[] = ['end_time', '>', time()]; - $data = $coupon_model->where($dis)->where(function ($query) use ($where){ + $data = $coupon_model->where($dis)->where(function ($query) use ($where) { $query->whereOr($where); })->paginate(10)->toArray(); - if(!empty($coupon['data'])){ + if (!empty($coupon['data'])) { - foreach ($coupon['data'] as &$v){ + foreach ($coupon['data'] as &$v) { - $v['start_time'] = date('Y.m.d H:i',$v['start_time']).' - '.date('Y.m.d H:i',$v['end_time']); + $v['start_time'] = date('Y.m.d H:i', $v['start_time']) . ' - ' . date('Y.m.d H:i', $v['end_time']); } @@ -1007,15 +1063,16 @@ class Index extends ApiRest * @DataTime: 2022-06-15 22:49 * @功能说明:用户获取卡券 */ - public function userGetCoupon(){ + public function userGetCoupon() + { $input = $this->_input; $coupon_record_model = new CouponRecord(); - $res = $coupon_record_model->recordAdd($input['coupon_id'],$this->getUserId(),1,1); + $res = $coupon_record_model->recordAdd($input['coupon_id'], $this->getUserId(), 1, 1); - if(!empty($res['code'])){ + if (!empty($res['code'])) { $this->errorMsg($res['msg']); } @@ -1024,6 +1081,4 @@ class Index extends ApiRest } - - } diff --git a/app/farm/controller/IndexClaim.php b/app/farm/controller/IndexClaim.php index 21550a2..924ff54 100644 --- a/app/farm/controller/IndexClaim.php +++ b/app/farm/controller/IndexClaim.php @@ -1,5 +1,7 @@ 'collageFailCancelOrder', - 'event' => 'collageFailCancelOrder', + 'event' => 'collageFailCancelOrder', 'pay_config' => $this->payConfig() ); - publisher(json_encode($push_data, true)); + // 测试环境 不调取 + if (!is_local()) { + publisher(json_encode($push_data, true)); + } } @@ -79,7 +85,8 @@ class IndexClaim extends ApiRest * @DataTime: 2022-01-06 14:03 * @功能说明:认养轮播图 */ - public function claimBanner(){ + public function claimBanner() + { $input = $this->_param; @@ -87,9 +94,9 @@ class IndexClaim extends ApiRest $dis = [ - 'type' => $input['type'], + 'type' => $input['type'], - 'status' => 1, + 'status' => 1, 'uniacid' => $this->_uniacid ]; @@ -101,15 +108,13 @@ class IndexClaim extends ApiRest } - - - /** * @author chenniang * @DataTime: 2021-12-14 17:42 * @功能说明:认养分类列表 */ - public function claimCateList(){ + public function claimCateList() + { $input = $this->_param; @@ -117,11 +122,11 @@ class IndexClaim extends ApiRest $dis = [ - 'type' => $input['type'], + 'type' => $input['type'], 'uniacid' => $this->_uniacid, - 'status' => 1, + 'status' => 1, ]; @@ -136,72 +141,73 @@ class IndexClaim extends ApiRest * @DataTime: 2021-12-14 17:53 * @功能说明:认养列表 */ - public function claimList(){ + public function claimList() + { $input = $this->_param; $farmer_model = new Farmer(); - $claim_order = new ClaimOrder(); + $claim_order = new ClaimOrder(); - $user_model = new User(); + $user_model = new User(); - $input['sort'] = !empty($input['sort'])?$input['sort']:1; + $input['sort'] = !empty($input['sort']) ? $input['sort'] : 1; - $dis[] = ['a.uniacid','=',$this->_uniacid]; + $dis[] = ['a.uniacid', '=', $this->_uniacid]; - $dis[] = ['a.status','=',1]; + $dis[] = ['a.status', '=', 1]; - $dis[] = ['a.end_time','>',time()]; + $dis[] = ['a.end_time', '>', time()]; - if(!empty($input['cate_id'])){ + if (!empty($input['cate_id'])) { - $dis[] = ['b.cate_id','=',$input['cate_id']]; + $dis[] = ['b.cate_id', '=', $input['cate_id']]; - $dis[] = ['b.type','=',3]; + $dis[] = ['b.type', '=', 3]; } - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['a.title','like','%'.$input['title'].'%']; + $dis[] = ['a.title', 'like', '%' . $input['title'] . '%']; } - if(!empty($input['farmer_id'])){ + if (!empty($input['farmer_id'])) { - $dis[] = ['a.farmer_id','=',$input['farmer_id']]; + $dis[] = ['a.farmer_id', '=', $input['farmer_id']]; - }else{ + } else { $id = $farmer_model->farmerId($this->_uniacid); - $dis[] = ['a.farmer_id','in',$id]; + $dis[] = ['a.farmer_id', 'in', $id]; } - $lat = !empty($input['lat'])?$input['lat']:0; + $lat = !empty($input['lat']) ? $input['lat'] : 0; - $lng = !empty($input['lng'])?$input['lng']:0; + $lng = !empty($input['lng']) ? $input['lng'] : 0; - $alh = '(2 * 6378.137* ASIN(SQRT(POW(SIN(PI()*('.$lng.'- `lng`)/360),2)+COS(PI()*33.07078170776367/180)* COS('.$lat.' * PI()/180)*POW(SIN(PI()*('.$lat.'- lat)/360),2))))*1000 as distance'; + $alh = '(2 * 6378.137* ASIN(SQRT(POW(SIN(PI()*(' . $lng . '- `lng`)/360),2)+COS(PI()*33.07078170776367/180)* COS(' . $lat . ' * PI()/180)*POW(SIN(PI()*(' . $lat . '- lat)/360),2))))*1000 as distance'; - $data = $this->model->indexDataListV2($dis,$alh,$input['sort']); + $data = $this->model->indexDataListV2($dis, $alh, $input['sort']); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { - $v['count']['user_count'] = $claim_order->where(['claim_id'=>$v['id']])->where('pay_type','>',1)->group('user_id')->count(); + $v['count']['user_count'] = $claim_order->where(['claim_id' => $v['id']])->where('pay_type', '>', 1)->group('user_id')->count(); - $order_user_id = $claim_order->where(['claim_id'=>$v['id']])->where('pay_type','>',1)->group('user_id')->order('id desc')->limit(3)->column('user_id'); + $order_user_id = $claim_order->where(['claim_id' => $v['id']])->where('pay_type', '>', 1)->group('user_id')->order('id desc')->limit(3)->column('user_id'); - $v['count']['user_list'] = $user_model->where('id','in',$order_user_id)->field('avatarUrl')->select()->toArray(); + $v['count']['user_list'] = $user_model->where('id', 'in', $order_user_id)->field('avatarUrl')->select()->toArray(); - $v['farmer_info'] = $farmer_model->dataInfo(['id'=>$v['farmer_id']],'title,cover'); + $v['farmer_info'] = $farmer_model->dataInfo(['id' => $v['farmer_id']], 'title,cover'); - $v['start_time'] = date('Y-m-d',$v['start_time']); + $v['start_time'] = date('Y-m-d', $v['start_time']); - $v['end_time'] = date('Y-m-d',$v['end_time']); + $v['end_time'] = date('Y-m-d', $v['end_time']); } @@ -217,7 +223,8 @@ class IndexClaim extends ApiRest * @DataTime: 2021-12-16 10:34 * @功能说明:认养详情 */ - public function claimInfo(){ + public function claimInfo() + { $input = $this->_param; @@ -230,25 +237,25 @@ class IndexClaim extends ApiRest $farmer_model = new Farmer(); - $data['farmer_info'] = $farmer_model->dataInfo(['id'=>$data['farmer_id']]); + $data['farmer_info'] = $farmer_model->dataInfo(['id' => $data['farmer_id']]); $claim_text_model = new ClaimText(); - $data['process'] = $claim_text_model->where(['claim_id'=>$data['id']])->select()->toArray(); + $data['process'] = $claim_text_model->where(['claim_id' => $data['id']])->select()->toArray(); $mac_model = new Machine(); //仪器详情 - $data['machine_info'] = $mac_model->getDataInfo($data['id'],2); + $data['machine_info'] = $mac_model->getDataInfo($data['id'], 2); $collage_model = new CollageStart(); //拼团列表 - $data['collage_list'] = $collage_model->claimCollageLimit($data['id'],3,$this->getUserId()); + $data['collage_list'] = $collage_model->claimCollageLimit($data['id'], 3, $this->getUserId()); //用户正在发起的拼团 - $data['user_start_collage'] = $collage_model->userCollageIngData($this->getUserId(),$data['id']); + $data['user_start_collage'] = $collage_model->userCollageIngData($this->getUserId(), $data['id']); $collage_model = new ClaimCollage(); //商品拼团活动 - $data['collage_data'] = $collage_model->getAtvInfoIng($data['id'],$this->getUserId()); + $data['collage_data'] = $collage_model->getAtvInfoIng($data['id'], $this->getUserId()); return $this->success($data); @@ -260,19 +267,20 @@ class IndexClaim extends ApiRest * @DataTime: 2022-08-16 17:51 * @功能说明:认养拼团列表 */ - public function claimCollageList(){ + public function claimCollageList() + { $input = $this->_param; $collage_model = new CollageStart(); - $dis[] = ['end_time','>',time()]; + $dis[] = ['end_time', '>', time()]; - $dis[] = ['status','=',1]; + $dis[] = ['status', '=', 1]; - $dis[] = ['claim_id','=',$input['claim_id']]; + $dis[] = ['claim_id', '=', $input['claim_id']]; //拼团 - $data= $collage_model->claimCollageList($dis); + $data = $collage_model->claimCollageList($dis); return $this->success($data); @@ -284,7 +292,8 @@ class IndexClaim extends ApiRest * @DataTime: 2022-08-16 17:53 * @功能说明:认养拼团详情 */ - public function claimCollageInfo(){ + public function claimCollageInfo() + { $input = $this->_param; @@ -294,16 +303,16 @@ class IndexClaim extends ApiRest $order_model = new ClaimOrder(); - $data = $collage_model->dataInfo(['id'=>$input['id']]); + $data = $collage_model->dataInfo(['id' => $input['id']]); - if(empty($data)){ + if (empty($data)) { $this->errorMsg('拼团未找到'); } - $data['user_list'] = $join_model->collageUserAvatar($input['id'],5); + $data['user_list'] = $join_model->collageUserAvatar($input['id'], 5); - $claim = $this->model->dataInfo(['id'=>$data['claim_id']]); + $claim = $this->model->dataInfo(['id' => $data['claim_id']]); $data['claim_title'] = $claim['title']; @@ -311,28 +320,24 @@ class IndexClaim extends ApiRest $data['claim_price'] = $claim['price']; - $data['can_start'] = $collage_model->startAtvCheck($this->getUserId(),$data['atv_id']); + $data['can_start'] = $collage_model->startAtvCheck($this->getUserId(), $data['atv_id']); //是否还能发起该活动其他的拼团 - $data['can_start'] = !empty($data['can_start']['code'])?0:1; + $data['can_start'] = !empty($data['can_start']['code']) ? 0 : 1; //是否能参与拼团 - $data['can_join'] = $join_model->collageCanJoin($this->getUserId(),$data['id']); + $data['can_join'] = $join_model->collageCanJoin($this->getUserId(), $data['id']); return $this->success($data); } - - - - - /** * @author chenniang * @DataTime: 2022-01-10 10:05 * @功能说明:下单页信息 */ - public function claimPayOrderInfo(){ + public function claimPayOrderInfo() + { $input = $this->_param; @@ -340,36 +345,36 @@ class IndexClaim extends ApiRest $data = $order_model->payOrderInfo($input); - if(!empty($data['code'])){ + if (!empty($data['code'])) { $this->errorMsg($data['msg']); } $farmer_model = new Farmer(); - $arr['farmer_info'] = $farmer_model->dataInfo(['id'=>$data['farmer_id']]); + $arr['farmer_info'] = $farmer_model->dataInfo(['id' => $data['farmer_id']]); - $arr['claim_info'] = $data; + $arr['claim_info'] = $data; - $address_model = new Address(); + $address_model = new Address(); - if(!empty($input['address_id'])){ + if (!empty($input['address_id'])) { - $arr['address'] = $address_model->dataInfo(['id'=>$input['address_id']]); + $arr['address'] = $address_model->dataInfo(['id' => $input['address_id']]); - }else{ + } else { - $arr['address'] = $address_model->dataInfo(['user_id'=>$this->getUserId(),'status'=>1]); + $arr['address'] = $address_model->dataInfo(['user_id' => $this->getUserId(), 'status' => 1]); } - $coupon_modle = new Coupon(); + $coupon_modle = new Coupon(); - $coupon_record_model = new CouponRecord(); + $coupon_record_model = new CouponRecord(); //可用优惠券数量 - $canUseCoupon = $coupon_modle->canUseCoupon($this->getUserId(),$data['pay_price'],3); + $canUseCoupon = $coupon_modle->canUseCoupon($this->getUserId(), $data['pay_price'], 3); - $arr['canUseCoupon'] = $coupon_record_model->where('id','in',$canUseCoupon)->sum('num'); + $arr['canUseCoupon'] = $coupon_record_model->where('id', 'in', $canUseCoupon)->sum('num'); $arr['pay_price'] = $data['pay_price']; @@ -387,15 +392,16 @@ class IndexClaim extends ApiRest * @DataTime: 2021-12-16 10:57 * @功能说明:认养下单 */ - public function claimPayOrder(){ + public function claimPayOrder() + { $input = $this->_input; $order_model = new ClaimOrder(); - $data = $order_model->payOrderInfo($input,1); + $data = $order_model->payOrderInfo($input, 1); - if(!empty($data['code'])){ + if (!empty($data['code'])) { $this->errorMsg($data['msg']); } @@ -404,73 +410,73 @@ class IndexClaim extends ApiRest $order_insert = [ - 'uniacid' => $this->_uniacid, + 'uniacid' => $this->_uniacid, - 'pay_type' => 1, + 'pay_type' => 1, - 'order_code' => orderCode(), + 'order_code' => orderCode(), - 'claim_code' => short_orderCode(), + 'claim_code' => short_orderCode(), - 'user_id' => $this->getUserId(), + 'user_id' => $this->getUserId(), - 'pay_price' => round($data['pay_price'],2), + 'pay_price' => round($data['pay_price'], 2), - 'get_integral' => round($data['pay_price'],2), + 'get_integral' => round($data['pay_price'], 2), - 'init_price' => round($data['init_price'],2), + 'init_price' => round($data['init_price'], 2), - 'balance' => $input['pay_model']==2?round($data['pay_price'],2):0, + 'balance' => $input['pay_model'] == 2 ? round($data['pay_price'], 2) : 0, - 'goods_id' => $data['id'], + 'goods_id' => $data['id'], - 'goods_name' => $data['title'], + 'goods_name' => $data['title'], - 'goods_cover' => $data['cover'], + 'goods_cover' => $data['cover'], - 'goods_price' => $data['price'], + 'goods_price' => $data['price'], - 'breed' => $data['breed'], + 'breed' => $data['breed'], - 'cycle' => $data['cycle'], + 'cycle' => $data['cycle'], - 'start_time' => $data['start_time'], + 'start_time' => $data['start_time'], - 'end_time' => $data['end_time'], + 'end_time' => $data['end_time'], 'harvest_text' => $data['harvest_text'], - 'harvest_cover'=> $data['harvest_cover'], + 'harvest_cover' => $data['harvest_cover'], - 'name' => $input['claim_name'], + 'name' => $input['claim_name'], - 'send_type' => $input['send_type'], + 'send_type' => $input['send_type'], - 'num' => $input['num'], + 'num' => $input['num'], - 'text' => $input['text'], + 'text' => $input['text'], - 'claim_id' => $data['id'], + 'claim_id' => $data['id'], - 'farmer_id' => $data['farmer_id'], + 'farmer_id' => $data['farmer_id'], - 'source_id' => $data['source_id'], + 'source_id' => $data['source_id'], - 'send_cycle' => $data['send_cycle'], + 'send_cycle' => $data['send_cycle'], - 'send_times' => $data['send_times'], + 'send_times' => $data['send_times'], - 'unit' => $data['unit'], - // - 'over_time' => time()+$this->_config['over_time']*60, + 'unit' => $data['unit'], + // + 'over_time' => time() + $this->_config['over_time'] * 60, - 'pay_model' => $input['pay_model'], + 'pay_model' => $input['pay_model'], - 'coupon_id' => $data['coupon_id'], + 'coupon_id' => $data['coupon_id'], - 'discount_price'=> $data['coupon_discount'], + 'discount_price' => $data['coupon_discount'], - 'is_collage' => !empty($input['collage_start_id'])||!empty($input['collage_join_id'])?1:0, + 'is_collage' => !empty($input['collage_start_id']) || !empty($input['collage_join_id']) ? 1 : 0, ]; @@ -480,7 +486,7 @@ class IndexClaim extends ApiRest $res = $order_model->dataAdd($order_insert); - if($res==0){ + if ($res == 0) { Db::rollback(); @@ -494,9 +500,9 @@ class IndexClaim extends ApiRest $input['uniacid'] = $this->_uniacid; - $res = $address_model->orderAddressAdd($input['address_id'],$order_id,$input['send_type'],2,$input); + $res = $address_model->orderAddressAdd($input['address_id'], $order_id, $input['send_type'], 2, $input); - if($res==0){ + if ($res == 0) { Db::rollback(); @@ -506,17 +512,17 @@ class IndexClaim extends ApiRest //加销量减库存 $update = [ - 'stock' => $data['stock'] -$input['num'], + 'stock' => $data['stock'] - $input['num'], - 'sale_num' => $data['sale_num']+$input['num'], + 'sale_num' => $data['sale_num'] + $input['num'], - 'lock' => $data['lock']+1 + 'lock' => $data['lock'] + 1 ]; - $res = $this->model->where(['id'=>$data['id'],'lock'=>$data['lock']])->update($update); + $res = $this->model->where(['id' => $data['id'], 'lock' => $data['lock']])->update($update); - if($res==0){ + if ($res == 0) { Db::rollback(); @@ -524,23 +530,23 @@ class IndexClaim extends ApiRest } //使用优惠券 - if(!empty($data['coupon_id'])){ + if (!empty($data['coupon_id'])) { $coupon_record_model = new CouponRecord(); - $coupon_record_model->couponUse($data['coupon_id'],$order_id,3); + $coupon_record_model->couponUse($data['coupon_id'], $order_id, 3); } $is_start = 0; //发起拼团 - if(!empty($data['collage_start_data'])){ + if (!empty($data['collage_start_data'])) { $start_model = new CollageStart(); - $data['collage_join_data'] = $start_model->startCollage($order_insert,$data['collage_start_data']); + $data['collage_join_data'] = $start_model->startCollage($order_insert, $data['collage_start_data']); - if(!empty($data['collage_join_data']['code'])){ + if (!empty($data['collage_join_data']['code'])) { Db::rollback(); @@ -551,13 +557,13 @@ class IndexClaim extends ApiRest } //参与拼团 - if(!empty($data['collage_join_data'])){ + if (!empty($data['collage_join_data'])) { $join_model = new CollageJoin(); - $res = $join_model->joinCollage($order_insert,$data['collage_join_data'],$is_start); + $res = $join_model->joinCollage($order_insert, $data['collage_join_data'], $is_start); - if(!empty($res['code'])){ + if (!empty($res['code'])) { Db::rollback(); @@ -568,46 +574,46 @@ class IndexClaim extends ApiRest Db::commit(); //如果是0元 - if($order_insert['pay_price']<=0){ + if ($order_insert['pay_price'] <= 0) { - $order_model->orderResult($order_insert['order_code'],$order_insert['order_code']); + $order_model->orderResult($order_insert['order_code'], $order_insert['order_code']); return $this->success(true); } //余额支付 - if($input['pay_model']==2){ + if ($input['pay_model'] == 2) { $user_model = new \app\farm\model\User(); - $user_balance= $user_model->where(['id'=>$this->getUserId()])->value('balance'); + $user_balance = $user_model->where(['id' => $this->getUserId()])->value('balance'); - if($user_balance<$order_insert['pay_price']){ + if ($user_balance < $order_insert['pay_price']) { $this->errorMsg('余额不足'); } - $order_model->orderResult($order_insert['order_code'],$order_insert['order_code']); + $order_model->orderResult($order_insert['order_code'], $order_insert['order_code']); return $this->success(true); - }elseif ($input['pay_model']==3){ + } elseif ($input['pay_model'] == 3) { $pay_model = new PayModel($this->payConfig()); - $jsApiParameters = $pay_model->aliPay($order_insert['order_code'],$order_insert['pay_price'],'认养商品'); + $jsApiParameters = $pay_model->aliPay($order_insert['order_code'], $order_insert['pay_price'], '认养商品'); - $arr['pay_list']= $jsApiParameters; + $arr['pay_list'] = $jsApiParameters; - $arr['order_code']= $order_insert['order_code']; + $arr['order_code'] = $order_insert['order_code']; - }else{ + } else { //微信支付 $pay_controller = new \app\shop\controller\IndexWxPay($this->app); //支付 - $jsApiParameters= $pay_controller->createWeixinPay($this->payConfig(),$this->getUserInfo()['openid'],$this->_uniacid,"认养订单",['type' => 'Claim' , 'out_trade_no' => $order_insert['order_code']],$order_insert['pay_price']); + $jsApiParameters = $pay_controller->createWeixinPay($this->payConfig(), $this->getUserInfo()['openid'], $this->_uniacid, "认养订单", ['type' => 'Claim', 'out_trade_no' => $order_insert['order_code']], $order_insert['pay_price']); - $arr['pay_list']= $jsApiParameters; + $arr['pay_list'] = $jsApiParameters; } @@ -621,52 +627,53 @@ class IndexClaim extends ApiRest * @DataTime: 2021-12-20 10:17 * @功能说明:认养重新下单 */ - public function claimRePayOrder(){ + public function claimRePayOrder() + { $input = $this->_input; $order_model = new ClaimOrder(); - $order_insert = $order_model->dataInfo(['id'=>$input['id']]); + $order_insert = $order_model->dataInfo(['id' => $input['id']]); - if($order_insert['pay_type']!=1){ + if ($order_insert['pay_type'] != 1) { $this->errorMsg('订单状态错误'); } //余额支付 - if($order_insert['pay_model']==2){ + if ($order_insert['pay_model'] == 2) { $user_model = new \app\farm\model\User(); - $user_balance= $user_model->where(['id'=>$this->getUserId()])->value('balance'); + $user_balance = $user_model->where(['id' => $this->getUserId()])->value('balance'); - if($user_balance<$order_insert['pay_price']){ + if ($user_balance < $order_insert['pay_price']) { $this->errorMsg('余额不足'); } - $order_model->orderResult($order_insert['order_code'],$order_insert['order_code']); + $order_model->orderResult($order_insert['order_code'], $order_insert['order_code']); return $this->success(true); - }elseif ($order_insert['pay_model']==3){ + } elseif ($order_insert['pay_model'] == 3) { $pay_model = new PayModel($this->payConfig()); - $jsApiParameters = $pay_model->aliPay($order_insert['order_code'],$order_insert['pay_price'],'认养商品'); + $jsApiParameters = $pay_model->aliPay($order_insert['order_code'], $order_insert['pay_price'], '认养商品'); - $arr['pay_list'] = $jsApiParameters; + $arr['pay_list'] = $jsApiParameters; - $arr['order_code']= $order_insert['order_code']; + $arr['order_code'] = $order_insert['order_code']; - }else{ + } else { //微信支付 $pay_controller = new \app\shop\controller\IndexWxPay($this->app); //支付 - $jsApiParameters= $pay_controller->createWeixinPay($this->payConfig(),$this->getUserInfo()['openid'],$this->_uniacid,"认养订单",['type' => 'Claim' , 'out_trade_no' => $order_insert['order_code']],$order_insert['pay_price']); + $jsApiParameters = $pay_controller->createWeixinPay($this->payConfig(), $this->getUserInfo()['openid'], $this->_uniacid, "认养订单", ['type' => 'Claim', 'out_trade_no' => $order_insert['order_code']], $order_insert['pay_price']); - $arr['pay_list']= $jsApiParameters; + $arr['pay_list'] = $jsApiParameters; } return $this->success($arr); @@ -679,65 +686,66 @@ class IndexClaim extends ApiRest * @DataTime: 2021-12-28 11:26 * @功能说明:用户下单列表 */ - public function orderList(){ + public function orderList() + { $input = $this->_param; - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['user_id','=',$this->getUserId()]; + $dis[] = ['user_id', '=', $this->getUserId()]; - if(!empty($input['pay_type'])){ + if (!empty($input['pay_type'])) { - $dis[] = ['pay_type','=',$input['pay_type']]; + $dis[] = ['pay_type', '=', $input['pay_type']]; } - if(!empty($input['order_code'])){ + if (!empty($input['order_code'])) { - $dis[] = ['order_code','like','%'.$input['order_code'].'%']; + $dis[] = ['order_code', 'like', '%' . $input['order_code'] . '%']; } - $order_model = new ClaimOrder(); + $order_model = new ClaimOrder(); $farmer_model = new Farmer(); - $eva_model = new Evaluate(); + $eva_model = new Evaluate(); $data = $order_model->dataList($dis); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { - $v['farmer_info'] = $farmer_model->dataInfo(['id'=>$v['farmer_id']],'title'); + $v['farmer_info'] = $farmer_model->dataInfo(['id' => $v['farmer_id']], 'title'); $dis = [ 'user_id' => $this->getUserId(), - 'order_id'=> $v['id'], + 'order_id' => $v['id'], - 'type' => 1 + 'type' => 1 ]; - $have_eva = $eva_model->where($dis)->where('status','>',-1)->find(); + $have_eva = $eva_model->where($dis)->where('status', '>', -1)->find(); //是否已经评价 - $v['have_eva'] = !empty($have_eva)?1:0; + $v['have_eva'] = !empty($have_eva) ? 1 : 0; } } - $arr = [2=>'claim_count',3=>'send_count']; + $arr = [2 => 'claim_count', 3 => 'send_count']; - foreach ($arr as $key => $value){ + foreach ($arr as $key => $value) { $where = [ 'user_id' => $this->getUserId(), - 'pay_type'=> $key + 'pay_type' => $key ]; $data['count'][$value] = $order_model->where($where)->count(); @@ -754,7 +762,8 @@ class IndexClaim extends ApiRest * @DataTime: 2021-12-28 11:52 * @功能说明:用户下单详情 */ - public function orderInfo(){ + public function orderInfo() + { $input = $this->_param; @@ -773,19 +782,19 @@ class IndexClaim extends ApiRest $data['over_time'] -= time(); - $data['create_time'] = date('Y-m-d H:i:s',$data['create_time']); + $data['create_time'] = date('Y-m-d H:i:s', $data['create_time']); - $data['pay_time'] = $data['pay_time']>0?date('Y-m-d H:i:s',$data['pay_time']):0; + $data['pay_time'] = $data['pay_time'] > 0 ? date('Y-m-d H:i:s', $data['pay_time']) : 0; - $data['cancel_time'] = $data['cancel_time']>0?date('Y-m-d H:i:s',$data['cancel_time']):0; + $data['cancel_time'] = $data['cancel_time'] > 0 ? date('Y-m-d H:i:s', $data['cancel_time']) : 0; - $data['time_text'] = date('Y-m-d',$data['start_time']).'~'.date('Y-m-d',$data['end_time']); + $data['time_text'] = date('Y-m-d', $data['start_time']) . '~' . date('Y-m-d', $data['end_time']); //农场信息 - $data['farmer_info'] = $farmer_model->dataInfo(['id'=>$data['farmer_id']]); + $data['farmer_info'] = $farmer_model->dataInfo(['id' => $data['farmer_id']]); //溯源信息 - $data['source'] = $source_model->dataInfo(['id'=>$data['source_id']]); + $data['source'] = $source_model->dataInfo(['id' => $data['source_id']]); //是否可以配送 - $data['can_send'] = $data['pay_type']>1&&$data['end_time'] 1 && $data['end_time'] < time() ? 1 : 0; $eva_model = new Evaluate(); @@ -793,50 +802,50 @@ class IndexClaim extends ApiRest 'user_id' => $this->getUserId(), - 'order_id'=> $input['id'], + 'order_id' => $input['id'], - 'type' => 1 + 'type' => 1 ]; - $have_eva = $eva_model->where($dis)->where('status','>',-1)->find(); + $have_eva = $eva_model->where($dis)->where('status', '>', -1)->find(); //是否已经评价 - $data['have_eva'] = !empty($have_eva)?1:0; + $data['have_eva'] = !empty($have_eva) ? 1 : 0; - $address_order_model = new OrderAddress(); + $address_order_model = new OrderAddress(); - $address_model = new Address(); + $address_model = new Address(); - $data['address_info'] = $address_order_model->dataInfo(['order_id'=>$input['id'],'type'=>2]); + $data['address_info'] = $address_order_model->dataInfo(['order_id' => $input['id'], 'type' => 2]); - if(!empty($data['address_info']['address_id'])){ + if (!empty($data['address_info']['address_id'])) { - $data['address_info'] = $address_model->dataInfo(['id'=>$data['address_info']['address_id']]); + $data['address_info'] = $address_model->dataInfo(['id' => $data['address_info']['address_id']]); } $mac_model = new Machine(); //仪器详情 - $data['machine_info'] = $mac_model->getDataInfo($data['claim_id'],2); + $data['machine_info'] = $mac_model->getDataInfo($data['claim_id'], 2); - $send_tmpl_id = $this->model->where(['id'=>$data['claim_id']])->value('send_tmpl_id'); + $send_tmpl_id = $this->model->where(['id' => $data['claim_id']])->value('send_tmpl_id'); $freightTemplate_model = new FreightTemplate(); //配送运费模版 - $data['send_tmpl'] = $freightTemplate_model->dataInfo(['id'=>$send_tmpl_id]); + $data['send_tmpl'] = $freightTemplate_model->dataInfo(['id' => $send_tmpl_id]); - if($data['is_collage']==1){ + if ($data['is_collage'] == 1) { $collage_model = new CollageJoin(); - $collage_info = $collage_model->dataInfo(['order_id'=>$input['id']]); + $collage_info = $collage_model->dataInfo(['order_id' => $input['id']]); - if(!empty($collage_info)){ + if (!empty($collage_info)) { $data['collage_status'] = $collage_info['status']; - $data['collage_discount_price'] = $data['init_price']-$collage_info['price']; + $data['collage_discount_price'] = $data['init_price'] - $collage_info['price']; - $data['collage_discount_price'] = $data['collage_discount_price']>0?$data['collage_discount_price']:0; + $data['collage_discount_price'] = $data['collage_discount_price'] > 0 ? $data['collage_discount_price'] : 0; } @@ -852,7 +861,8 @@ class IndexClaim extends ApiRest * @DataTime: 2022-01-10 13:42 * @功能说明: */ - public function cancelOrder(){ + public function cancelOrder() + { $input = $this->_input; @@ -865,14 +875,14 @@ class IndexClaim extends ApiRest $order = $order_model->dataInfo($dis); - if($order['pay_type']!=1){ + if ($order['pay_type'] != 1) { $this->errorMsg('订单状态错误'); } $res = $order_model->cancelOrder($order); - if(!empty($res['code'])){ + if (!empty($res['code'])) { $this->errorMsg($res['msg']); } @@ -882,55 +892,55 @@ class IndexClaim extends ApiRest } - /** * @author chenniang * @DataTime: 2021-12-29 10:29 * @功能说明:养殖管理 */ - public function breedList(){ + public function breedList() + { $input = $this->_param; $breed_model = new Breed(); - $car_model = new Car(); + $car_model = new Car(); - $dis[] = ['a.uniacid','=',$this->_uniacid]; + $dis[] = ['a.uniacid', '=', $this->_uniacid]; - $dis[] = ['a.status','=',1]; + $dis[] = ['a.status', '=', 1]; - $dis[] = ['b.type','=',5]; + $dis[] = ['b.type', '=', 5]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['a.title','like','%'.$input['title'].'%']; + $dis[] = ['a.title', 'like', '%' . $input['title'] . '%']; } - $dis[] = ['b.store_id','=',$input['farmer_id']]; + $dis[] = ['b.store_id', '=', $input['farmer_id']]; $data = $breed_model->indexDataList($dis); $dis = [ - 'user_id'=>$this->getUserId(), + 'user_id' => $this->getUserId(), - 'type' =>1, + 'type' => 1, - 'status' =>1, + 'status' => 1, 'farmer_id' => $input['farmer_id'] ]; - $car = $breed_model->getCarList($this->getUserId(),$input['farmer_id']); + $car = $breed_model->getCarList($this->getUserId(), $input['farmer_id']); $data['count'] = $car['goods_num']; $data['total_price'] = $car['price']; - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { $dis['goods_id'] = $v['id']; @@ -951,7 +961,8 @@ class IndexClaim extends ApiRest * @DataTime: 2021-12-29 17:02 * @功能说明:养殖订单 */ - public function breedOrder(){ + public function breedOrder() + { $input = $this->_input; @@ -961,47 +972,47 @@ class IndexClaim extends ApiRest $claim_order_model = new ClaimOrder(); - $framer_model= new Farmer(); + $framer_model = new Farmer(); - $claim_order = $claim_order_model->dataInfo(['id'=>$input['claim_order_id']]); + $claim_order = $claim_order_model->dataInfo(['id' => $input['claim_order_id']]); - $pay_order = $breed_model->getCarList($this->getUserId(),$claim_order['farmer_id']); + $pay_order = $breed_model->getCarList($this->getUserId(), $claim_order['farmer_id']); - $farmer = $framer_model->dataInfo(['id'=>$claim_order['farmer_id'],'status'=>2]); + $farmer = $framer_model->dataInfo(['id' => $claim_order['farmer_id'], 'status' => 2]); - if(empty($farmer)){ + if (empty($farmer)) { $this->errorMsg('该农场主已被取消农场身份,无法下单'); } $order_insert = [ - 'uniacid' => $this->_uniacid, + 'uniacid' => $this->_uniacid, - 'order_code' => orderCode(), + 'order_code' => orderCode(), - 'user_id' => $this->getUserId(), + 'user_id' => $this->getUserId(), 'claim_order_id' => $input['claim_order_id'], - 'farmer_id' => $claim_order['farmer_id'], + 'farmer_id' => $claim_order['farmer_id'], - 'pay_price' => $pay_order['price'], + 'pay_price' => $pay_order['price'], - 'get_integral' => $pay_order['price'], + 'get_integral' => $pay_order['price'], - 'text' => $input['text'], + 'text' => $input['text'], - 'pay_model' => $input['pay_model'], + 'pay_model' => $input['pay_model'], - 'balance' => $input['pay_model']==2?round($pay_order['price'],2):0, + 'balance' => $input['pay_model'] == 2 ? round($pay_order['price'], 2) : 0, ]; Db::startTrans(); $res = $order_model->dataAdd($order_insert); - if($res==0){ + if ($res == 0) { Db::rollback(); @@ -1013,9 +1024,9 @@ class IndexClaim extends ApiRest $order_goods_model = new BreedOrderGoods(); - $res = $order_goods_model->orderAdd($pay_order['car_list'],$order_id); + $res = $order_goods_model->orderAdd($pay_order['car_list'], $order_id); - if($res==0){ + if ($res == 0) { Db::rollback(); @@ -1029,56 +1040,56 @@ class IndexClaim extends ApiRest 'farmer_id' => $claim_order['farmer_id'], - 'user_id' => $this->getUserId(), + 'user_id' => $this->getUserId(), - 'type' => 1, + 'type' => 1, - 'status' => 1 + 'status' => 1 ]; $car_model->where($dis)->delete(); Db::commit(); //如果是0元 - if($order_insert['pay_price']<=0){ + if ($order_insert['pay_price'] <= 0) { - $order_model->orderResult($order_insert['order_code'],$order_insert['order_code']); + $order_model->orderResult($order_insert['order_code'], $order_insert['order_code']); return $this->success(true); } //余额支付 - if($input['pay_model']==2){ + if ($input['pay_model'] == 2) { $user_model = new \app\farm\model\User(); - $user_balance= $user_model->where(['id'=>$this->getUserId()])->value('balance'); + $user_balance = $user_model->where(['id' => $this->getUserId()])->value('balance'); - if($user_balance<$order_insert['pay_price']){ + if ($user_balance < $order_insert['pay_price']) { $this->errorMsg('余额不足'); } - $order_model->orderResult($order_insert['order_code'],$order_insert['order_code']); + $order_model->orderResult($order_insert['order_code'], $order_insert['order_code']); return $this->success(true); - }elseif ($input['pay_model']==3){ + } elseif ($input['pay_model'] == 3) { $pay_model = new PayModel($this->payConfig()); - $jsApiParameters = $pay_model->aliPay($order_insert['order_code'],$order_insert['pay_price'],'养殖商品'); + $jsApiParameters = $pay_model->aliPay($order_insert['order_code'], $order_insert['pay_price'], '养殖商品'); - $arr['pay_list']= $jsApiParameters; + $arr['pay_list'] = $jsApiParameters; - $arr['order_code']= $order_insert['order_code']; + $arr['order_code'] = $order_insert['order_code']; - }else{ + } else { //微信支付 $pay_controller = new \app\shop\controller\IndexWxPay($this->app); //支付 - $jsApiParameters= $pay_controller->createWeixinPay($this->payConfig(),$this->getUserInfo()['openid'],$this->_uniacid,"养殖订单",['type' => 'Breed' , 'out_trade_no' => $order_insert['order_code']],$order_insert['pay_price']); + $jsApiParameters = $pay_controller->createWeixinPay($this->payConfig(), $this->getUserInfo()['openid'], $this->_uniacid, "养殖订单", ['type' => 'Breed', 'out_trade_no' => $order_insert['order_code']], $order_insert['pay_price']); - $arr['pay_list']= $jsApiParameters; + $arr['pay_list'] = $jsApiParameters; } return $this->success($arr); @@ -1091,13 +1102,14 @@ class IndexClaim extends ApiRest * @DataTime: 2022-01-10 15:52 * @功能说明:养殖订单列表 */ - public function breedOrderList(){ + public function breedOrderList() + { $input = $this->_param; - $dis[] = ['pay_type','>',1]; + $dis[] = ['pay_type', '>', 1]; - $dis[] = ['claim_order_id','=',$input['claim_order_id']]; + $dis[] = ['claim_order_id', '=', $input['claim_order_id']]; $order_model = new BreedOrder(); @@ -1113,19 +1125,20 @@ class IndexClaim extends ApiRest * @DataTime: 2022-01-10 16:07 * @功能说明:养殖订单详情 */ - public function breedOrderInfo(){ + public function breedOrderInfo() + { $input = $this->_param; - $dis[] = ['id','=',$input['id']]; + $dis[] = ['id', '=', $input['id']]; $order_model = new BreedOrder(); $data = $order_model->dataInfo($dis); - $data['create_time'] = date('Y-m-d H:i:s',$data['create_time']); + $data['create_time'] = date('Y-m-d H:i:s', $data['create_time']); - $data['pay_time'] = !empty($data['pay_time'])?date('Y-m-d H:i:s',$data['pay_time']):0; + $data['pay_time'] = !empty($data['pay_time']) ? date('Y-m-d H:i:s', $data['pay_time']) : 0; return $this->success($data); @@ -1138,7 +1151,8 @@ class IndexClaim extends ApiRest * @DataTime: 2022-02-08 17:14 * @功能说明:配送订单列表 */ - public function userSendOrderList(){ + public function userSendOrderList() + { $input = $this->_param; @@ -1156,41 +1170,42 @@ class IndexClaim extends ApiRest * @DataTime: 2022-02-08 13:53 * @功能说明:申请认养订单发货 */ - public function sendOrderApply(){ + public function sendOrderApply() + { $input = $this->_input; $order_model = new ClaimOrder(); - $farmer_model= new Farmer(); + $farmer_model = new Farmer(); - $config_model= new Config(); + $config_model = new Config(); - $address_model = new Address(); + $address_model = new Address(); $send_order_model = new SendOrder(); - $order = $order_model->dataInfo(['id'=>$input['order_id']]); + $order = $order_model->dataInfo(['id' => $input['order_id']]); - if($order['pay_type']<2){ + if ($order['pay_type'] < 2) { $this->errorMsg('订单未支付'); } //已经申请的配送次数 - $send_count = $send_order_model->where(['order_id'=>$input['order_id'],'type'=>1])->where('pay_type','>',1)->count(); + $send_count = $send_order_model->where(['order_id' => $input['order_id'], 'type' => 1])->where('pay_type', '>', 1)->count(); - if($send_count>=$order['send_times']){ + if ($send_count >= $order['send_times']) { $this->errorMsg('已经到达配送次数上线'); } - $times = $send_order_model->where(['order_id'=>$input['order_id'],'type'=>1])->where('pay_time','>',0)->count(); + $times = $send_order_model->where(['order_id' => $input['order_id'], 'type' => 1])->where('pay_time', '>', 0)->count(); - $farmer= $farmer_model->dataInfo(['id'=>$order['farmer_id'],'status'=>2]); + $farmer = $farmer_model->dataInfo(['id' => $order['farmer_id'], 'status' => 2]); - if(empty($farmer)){ + if (empty($farmer)) { $this->errorMsg('农场主未找到'); } @@ -1198,19 +1213,19 @@ class IndexClaim extends ApiRest $send_price = $distance = 0; //快递 - if($input['send_type']==2){ + if ($input['send_type'] == 2) { - $address = $address_model->dataInfo(['id'=>$input['address_id']]); + $address = $address_model->dataInfo(['id' => $input['address_id']]); - if(empty($address)){ + if (empty($address)) { $this->errorMsg('地址信息未找到'); } - $cliam_info = $this->model->dataInfo(['id'=>$order['claim_id']]); + $cliam_info = $this->model->dataInfo(['id' => $order['claim_id']]); - if(empty($cliam_info)){ + if (empty($cliam_info)) { $this->errorMsg('认养信息被删除'); @@ -1220,14 +1235,14 @@ class IndexClaim extends ApiRest 'send_tmpl_id' => $cliam_info['send_tmpl_id'], - 'goods_num' => $input['send_num'], + 'goods_num' => $input['send_num'], 'total_weight' => $input['send_num'], ]; - $send_data = $config_model->getGoodsSendPrice($input['address_id'],$goods_info,2,2); + $send_data = $config_model->getGoodsSendPrice($input['address_id'], $goods_info, 2, 2); - if(!empty($send_data['code'])){ + if (!empty($send_data['code'])) { $this->errorMsg($send_data['msg']); } @@ -1236,110 +1251,110 @@ class IndexClaim extends ApiRest $send_tmpl_type = $send_data['type']; - }else{ + } else { $address['user_name'] = $input['user_name']; - $address['mobile'] = $input['mobile']; + $address['mobile'] = $input['mobile']; } $order_insert = [ - 'uniacid' => $this->_uniacid, + 'uniacid' => $this->_uniacid, - 'order_id' => $input['order_id'], + 'order_id' => $input['order_id'], - 'pay_model' => $input['pay_model'], + 'pay_model' => $input['pay_model'], - 'user_id' => $order['user_id'], + 'user_id' => $order['user_id'], - 'farmer_id' => $order['farmer_id'], + 'farmer_id' => $order['farmer_id'], - 'pay_price' => $send_price, + 'pay_price' => $send_price, 'get_integral' => $send_price, 'order_code' => orderCode(), - 'text' => $input['text'], + 'text' => $input['text'], // - 'over_time' => time()+$this->_config['over_time']*60, + 'over_time' => time() + $this->_config['over_time'] * 60, - 'type' => 1, + 'type' => 1, 'start_time' => $input['start_time'], - 'end_time' => $input['end_time'], + 'end_time' => $input['end_time'], - 'times' => $times+1, + 'times' => $times + 1, - 'send_type' => $input['send_type'], + 'send_type' => $input['send_type'], - 'address' => $input['send_type']==2?$address['address'].$address['address_info']:'', + 'address' => $input['send_type'] == 2 ? $address['address'] . $address['address_info'] : '', - 'user_name' => $address['user_name'], + 'user_name' => $address['user_name'], - 'mobile' => $address['mobile'], + 'mobile' => $address['mobile'], - 'lng' => $input['send_type']==2?$address['lng']:'', + 'lng' => $input['send_type'] == 2 ? $address['lng'] : '', - 'lat' => $input['send_type']==2?$address['lat']:'', + 'lat' => $input['send_type'] == 2 ? $address['lat'] : '', - 'balance' => $input['pay_model']==2?$send_price:0, + 'balance' => $input['pay_model'] == 2 ? $send_price : 0, - 'goods_num' => isset($send_tmpl_type)&&$send_tmpl_type==1?$input['send_num']:0, + 'goods_num' => isset($send_tmpl_type) && $send_tmpl_type == 1 ? $input['send_num'] : 0, - 'weight' => isset($send_tmpl_type)&&$send_tmpl_type==2?$input['send_num']:0, + 'weight' => isset($send_tmpl_type) && $send_tmpl_type == 2 ? $input['send_num'] : 0, ]; $res = $send_order_model->dataAdd($order_insert); - if($res==0){ + if ($res == 0) { $this->errorMsg('申请配送失败'); } //如果是0元 - if($order_insert['pay_price']<=0){ + if ($order_insert['pay_price'] <= 0) { - $send_order_model->orderResult($order_insert['order_code'],$order_insert['order_code']); + $send_order_model->orderResult($order_insert['order_code'], $order_insert['order_code']); return $this->success(true); } //余额支付 - if($input['pay_model']==2){ + if ($input['pay_model'] == 2) { $user_model = new \app\farm\model\User(); - $user_balance= $user_model->where(['id'=>$this->getUserId()])->value('balance'); + $user_balance = $user_model->where(['id' => $this->getUserId()])->value('balance'); - if($user_balance<$order_insert['pay_price']){ + if ($user_balance < $order_insert['pay_price']) { $this->errorMsg('余额不足'); } - $send_order_model->orderResult($order_insert['order_code'],$order_insert['order_code']); + $send_order_model->orderResult($order_insert['order_code'], $order_insert['order_code']); return $this->success(true); - }elseif ($input['pay_model']==3){ + } elseif ($input['pay_model'] == 3) { $pay_model = new PayModel($this->payConfig()); - $jsApiParameters = $pay_model->aliPay($order_insert['order_code'],$order_insert['pay_price'],'配送订单'); + $jsApiParameters = $pay_model->aliPay($order_insert['order_code'], $order_insert['pay_price'], '配送订单'); - $arr['pay_list']= $jsApiParameters; + $arr['pay_list'] = $jsApiParameters; - $arr['order_code']= $order_insert['order_code']; + $arr['order_code'] = $order_insert['order_code']; - }else{ + } else { //微信支付 $pay_controller = new \app\shop\controller\IndexWxPay($this->app); //支付 - $jsApiParameters= $pay_controller->createWeixinPay($this->payConfig(),$this->getUserInfo()['openid'],$this->_uniacid,"认养配送订单",['type' => 'ClaimSend' , 'out_trade_no' => $order_insert['order_code']],$order_insert['pay_price']); + $jsApiParameters = $pay_controller->createWeixinPay($this->payConfig(), $this->getUserInfo()['openid'], $this->_uniacid, "认养配送订单", ['type' => 'ClaimSend', 'out_trade_no' => $order_insert['order_code']], $order_insert['pay_price']); - $arr['pay_list']= $jsApiParameters; + $arr['pay_list'] = $jsApiParameters; } @@ -1353,54 +1368,55 @@ class IndexClaim extends ApiRest * @DataTime: 2022-02-08 15:23 * @功能说明:配送订单下单详情 */ - public function sendOrderPayInfo(){ + public function sendOrderPayInfo() + { - $input = $this->_param; + $input = $this->_param; $order_model = new ClaimOrder(); - $farmer_model= new Farmer(); + $farmer_model = new Farmer(); - $config_model= new Config(); + $config_model = new Config(); $address_model = new Address(); - $order = $order_model->dataInfo(['id'=>$input['order_id']]); + $order = $order_model->dataInfo(['id' => $input['order_id']]); - $farmer= $farmer_model->dataInfo(['id'=>$order['farmer_id']]); + $farmer = $farmer_model->dataInfo(['id' => $order['farmer_id']]); - if(empty($farmer)){ + if (empty($farmer)) { $this->errorMsg('农场主未找到'); } - $address = $address_model->dataInfo(['id'=>$input['address_id']]); + $address = $address_model->dataInfo(['id' => $input['address_id']]); - if(empty($address)){ + if (empty($address)) { $this->errorMsg('地址信息未找到'); } - $cliam_info = $this->model->dataInfo(['id'=>$order['claim_id']]); + $cliam_info = $this->model->dataInfo(['id' => $order['claim_id']]); $freightTemplate_model = new FreightTemplate(); - $data['send_tmpl'] = $freightTemplate_model->dataInfo(['id'=>$cliam_info['send_tmpl_id']]); + $data['send_tmpl'] = $freightTemplate_model->dataInfo(['id' => $cliam_info['send_tmpl_id']]); - if(!empty($input['send_num'])){ + if (!empty($input['send_num'])) { $goods_info = [ 'send_tmpl_id' => $cliam_info['send_tmpl_id'], - 'goods_num' => $input['send_num'], + 'goods_num' => $input['send_num'], 'total_weight' => $input['send_num'], ]; - $data['send_price'] = $config_model->getGoodsSendPrice($input['address_id'],$goods_info,2); + $data['send_price'] = $config_model->getGoodsSendPrice($input['address_id'], $goods_info, 2); - if(!empty($data['send_price']['code'])){ + if (!empty($data['send_price']['code'])) { $this->errorMsg($data['send_price']['msg']); } @@ -1416,32 +1432,33 @@ class IndexClaim extends ApiRest * @DataTime: 2022-02-08 15:10 * @功能说明:获取配送时间段 */ - public function sendTime(){ + public function sendTime() + { $config_model = new Config(); - $send_config = new SendConfig(); + $send_config = new SendConfig(); - $config = $config_model->dataInfo(['uniacid'=>$this->_uniacid]); + $config = $config_model->dataInfo(['uniacid' => $this->_uniacid]); - $config['app_day'] = $config['app_day']>30?30:$config['app_day']; + $config['app_day'] = $config['app_day'] > 30 ? 30 : $config['app_day']; $i = 0; //预约的每一天 - while ($i<$config['app_day']){ + while ($i < $config['app_day']) { - $time = time()+86400*$i; + $time = time() + 86400 * $i; - $arr['date'] = date('Y-m-d',$time); + $arr['date'] = date('Y-m-d', $time); - $arr['week'] = changeWeek(date('w',$time)); + $arr['week'] = changeWeek(date('w', $time)); $data['date'][] = $arr; $i++; } //每天时间段 - $data['time'] = $send_config->where(['uniacid'=>$this->_uniacid,'status'=>1])->select()->toArray(); + $data['time'] = $send_config->where(['uniacid' => $this->_uniacid, 'status' => 1])->select()->toArray(); return $this->success($data); @@ -1453,49 +1470,50 @@ class IndexClaim extends ApiRest * @DataTime: 2022-02-08 17:57 * @功能说明:配送订单退款 */ - public function sendOrderRefund(){ + public function sendOrderRefund() + { $input = $this->_input; $send_order_model = new SendOrder(); - $send_order = $send_order_model->dataInfo(['id'=>$input['id']]); + $send_order = $send_order_model->dataInfo(['id' => $input['id']]); - if(empty($send_order)){ + if (empty($send_order)) { $this->errorMsg('订单未找到'); } - if($send_order['pay_type']!=2){ + if ($send_order['pay_type'] != 2) { $this->errorMsg('订单状态错误'); } Db::startTrans(); - $res = $send_order_model->refundCash($send_order,$this->payConfig($this->_uniacid)); + $res = $send_order_model->refundCash($send_order, $this->payConfig($this->_uniacid)); - if(!empty($res['code'])){ + if (!empty($res['code'])) { $this->errorMsg($res['msg']); } - $send_order_model->dataUpdate(['id'=>$send_order['id']],['refund_time'=>time(),'pay_type'=>-1,'refund'=>1]); + $send_order_model->dataUpdate(['id' => $send_order['id']], ['refund_time' => time(), 'pay_type' => -1, 'refund' => 1]); //增加财务流水 $fin_water_model = new FinanceWater(); - $res = $fin_water_model->addWater($input['id'],11,1,1); + $res = $fin_water_model->addWater($input['id'], 11, 1, 1); - if($res==0){ + if ($res == 0) { Db::rollback(); $this->errorMsg('退款失败1'); } - $res = $fin_water_model->dataUpdate(['order_id'=>$send_order['id'],'type'=>10],['cash_status'=>1]); + $res = $fin_water_model->dataUpdate(['order_id' => $send_order['id'], 'type' => 10], ['cash_status' => 1]); - if($res==0){ + if ($res == 0) { Db::rollback(); @@ -1513,27 +1531,28 @@ class IndexClaim extends ApiRest * @DataTime: 2022-02-09 10:24 * @功能说明:配送订单收货 */ - public function sendOrderReceiving(){ + public function sendOrderReceiving() + { $input = $this->_input; $send_order_model = new SendOrder(); - $send_order = $send_order_model->dataInfo(['id'=>$input['id']]); + $send_order = $send_order_model->dataInfo(['id' => $input['id']]); - if(empty($send_order)){ + if (empty($send_order)) { $this->errorMsg('订单未找到'); } - if($send_order['pay_type']!=3){ + if ($send_order['pay_type'] != 3) { $this->errorMsg('订单状态错误'); } $res = $send_order_model->sendOrderReceiving($send_order); - if(!empty($res['code'])){ + if (!empty($res['code'])) { $this->errorMsg($res['msg']); } @@ -1548,29 +1567,30 @@ class IndexClaim extends ApiRest * @DataTime: 2022-02-09 14:00 * @功能说明:配送订单详情 */ - public function sendOrderInfo(){ + public function sendOrderInfo() + { $input = $this->_param; $send_order_model = new SendOrder(); - $claim_order_model= new ClaimOrder(); + $claim_order_model = new ClaimOrder(); - $send_order = $send_order_model->dataInfo(['id'=>$input['id']]); + $send_order = $send_order_model->dataInfo(['id' => $input['id']]); - $send_order['create_time'] = date('Y-m-d H:i:s',$send_order['create_time']); + $send_order['create_time'] = date('Y-m-d H:i:s', $send_order['create_time']); - $send_order['time_text'] = date('Y-m-d H:i',$send_order['start_time']).'~'.date('H:i',$send_order['end_time']); + $send_order['time_text'] = date('Y-m-d H:i', $send_order['start_time']) . '~' . date('H:i', $send_order['end_time']); - $send_order['pay_time'] = $send_order['pay_time']>0?date('Y-m-d H:i:s',$send_order['pay_time']):0; + $send_order['pay_time'] = $send_order['pay_time'] > 0 ? date('Y-m-d H:i:s', $send_order['pay_time']) : 0; - $send_order['send_time'] = $send_order['send_time']>0?date('Y-m-d H:i:s',$send_order['send_time']):0; + $send_order['send_time'] = $send_order['send_time'] > 0 ? date('Y-m-d H:i:s', $send_order['send_time']) : 0; - $send_order['receiving_time'] = $send_order['receiving_time']>0?date('Y-m-d H:i:s',$send_order['receiving_time']):0; + $send_order['receiving_time'] = $send_order['receiving_time'] > 0 ? date('Y-m-d H:i:s', $send_order['receiving_time']) : 0; - $send_order['refund_time'] = $send_order['refund_time']>0?date('Y-m-d H:i:s',$send_order['refund_time']):0; + $send_order['refund_time'] = $send_order['refund_time'] > 0 ? date('Y-m-d H:i:s', $send_order['refund_time']) : 0; - $send_order['claim_order']= $claim_order_model->dataInfo(['id'=>$send_order['order_id']]); + $send_order['claim_order'] = $claim_order_model->dataInfo(['id' => $send_order['order_id']]); return $this->success($send_order); @@ -1582,7 +1602,8 @@ class IndexClaim extends ApiRest * @DataTime: 2021-07-10 00:40 * @功能说明:可用的优惠券列表 */ - public function couponList(){ + public function couponList() + { $input = $this->_param; @@ -1590,19 +1611,19 @@ class IndexClaim extends ApiRest $coupon_record_model = new CouponRecord(); - $order_model = new ClaimOrder(); + $order_model = new ClaimOrder(); $order_info = $order_model->payOrderInfo($input); - $coupon_id = $coupon_model->canUseCoupon($this->getUserId(),$order_info['pay_price'],3); + $coupon_id = $coupon_model->canUseCoupon($this->getUserId(), $order_info['pay_price'], 3); - $data = $coupon_record_model->where('id','in',$coupon_id)->order('id desc')->paginate(10)->toArray(); + $data = $coupon_record_model->where('id', 'in', $coupon_id)->order('id desc')->paginate(10)->toArray(); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { - $v['start_time'] = date('Y.m.d H:i',$v['start_time']).' - '.date('Y.m.d H:i',$v['end_time']); + $v['start_time'] = date('Y.m.d H:i', $v['start_time']) . ' - ' . date('Y.m.d H:i', $v['end_time']); } @@ -1618,15 +1639,16 @@ class IndexClaim extends ApiRest * @DataTime: 2022-08-16 15:15 * @功能说明:用户认养拼团 */ - public function userCollageLimit(){ + public function userCollageLimit() + { $input = $this->_param; $collage_model = new CollageJoin(); - $dis[] = ['a.user_id','=',$this->getUserId()]; + $dis[] = ['a.user_id', '=', $this->getUserId()]; - $dis[] = ['a.status','=',1]; + $dis[] = ['a.status', '=', 1]; $data = $collage_model->userCollageLimit($dis); @@ -1639,21 +1661,22 @@ class IndexClaim extends ApiRest * @DataTime: 2022-08-16 15:15 * @功能说明:用户认养拼团列表 */ - public function userCollageList(){ + public function userCollageList() + { $input = $this->_param; $collage_model = new CollageJoin(); - $dis[] = ['a.user_id','=',$this->getUserId()]; + $dis[] = ['a.user_id', '=', $this->getUserId()]; - if(!empty($input['status'])&&$input['status']==2){ + if (!empty($input['status']) && $input['status'] == 2) { - $dis[] = ['a.status','=',$input['status']]; + $dis[] = ['a.status', '=', $input['status']]; - }else{ + } else { - $dis[] = ['a.status','in',[1,3]]; + $dis[] = ['a.status', 'in', [1, 3]]; } $data = $collage_model->userCollagePage($dis); @@ -1669,33 +1692,34 @@ class IndexClaim extends ApiRest * @DataTime: 2022-08-16 16:12 * @功能说明:拼团商品列表 */ - public function collageList(){ + public function collageList() + { $collage_model = new ClaimCollage(); - $dis[] = ['a.uniacid','=',$this->_uniacid]; + $dis[] = ['a.uniacid', '=', $this->_uniacid]; - $dis[] = ['a.status','=',1]; + $dis[] = ['a.status', '=', 1]; - $dis[] = ['a.start_time','<',time()]; + $dis[] = ['a.start_time', '<', time()]; - $dis[] = ['a.end_time','>',time()]; + $dis[] = ['a.end_time', '>', time()]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['a.title','like','%'.$input['title'].'%']; + $dis[] = ['a.title', 'like', '%' . $input['title'] . '%']; } - if(!empty($input['goods_name'])){ + if (!empty($input['goods_name'])) { - $dis[] = ['b.title','like','%'.$input['goods_name'].'%']; + $dis[] = ['b.title', 'like', '%' . $input['goods_name'] . '%']; } $data = $collage_model->adminDataList($dis); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { $v['time_text'] = lbGetDatesss($v['end_time']); @@ -1707,8 +1731,4 @@ class IndexClaim extends ApiRest } - - - - } diff --git a/app/farm/controller/IndexFarmer.php b/app/farm/controller/IndexFarmer.php index 77fadc2..6aae7c7 100644 --- a/app/farm/controller/IndexFarmer.php +++ b/app/farm/controller/IndexFarmer.php @@ -1,5 +1,7 @@ model = new Farmer(); - $cap_dis[] = ['user_id','=',$this->getUserId()]; + $cap_dis[] = ['user_id', '=', $this->getUserId()]; - $cap_dis[] = ['type','=',1]; + $cap_dis[] = ['type', '=', 1]; - $cap_dis[] = ['status','in',[2,3]]; + $cap_dis[] = ['status', 'in', [2, 3]]; $this->farmer = $this->model->dataInfo($cap_dis); $action = $this->request->action(); - if(empty($this->farmer)&&!in_array($action,['sourceInfo'])){ + if (empty($this->farmer) && !in_array($action, ['sourceInfo'])) { $this->errorMsg('你还不是农场主'); } @@ -86,7 +89,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2022-02-24 16:13 * @功能说明:农场主详情 */ - public function farmerInfo(){ + public function farmerInfo() + { return $this->success($this->farmer); @@ -98,7 +102,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2022-02-24 16:16 * @功能说明:编辑农场主 */ - public function farmerUpdate(){ + public function farmerUpdate() + { $input = $this->_input; @@ -107,18 +112,18 @@ class IndexFarmer extends ApiRest 'id' => $this->farmer['id'] ]; - if(isset($input['imgs'])){ + if (isset($input['imgs'])) { - $input['imgs'] = !empty($input['imgs'])?implode(',',$input['imgs']):''; + $input['imgs'] = !empty($input['imgs']) ? implode(',', $input['imgs']) : ''; } - if(isset($input['idcard_imgs'])){ + if (isset($input['idcard_imgs'])) { - $input['idcard_imgs'] = !empty($input['idcard_imgs'])?implode(',',$input['idcard_imgs']):''; + $input['idcard_imgs'] = !empty($input['idcard_imgs']) ? implode(',', $input['idcard_imgs']) : ''; } - $res = $this->model->dataUpdate($dis,$input); + $res = $this->model->dataUpdate($dis, $input); return $this->success($res); @@ -130,28 +135,29 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-10 17:51 * @功能说明:土地列表 */ - public function landList(){ + public function landList() + { $input = $this->_param; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','>',-1]; + $dis[] = ['status', '>', -1]; - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; - $data = $this->land_model->dataList($dis,10); + $data = $this->land_model->dataList($dis, 10); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i:s', $v['create_time']); } } @@ -165,7 +171,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-10 18:05 * @功能说明:添加土地 */ - public function landAdd(){ + public function landAdd() + { $input = $this->_input; @@ -182,13 +189,13 @@ class IndexFarmer extends ApiRest } - /** * @author chenniang * @DataTime: 2021-12-10 18:05 * @功能说明:编辑土地 */ - public function landUpdate(){ + public function landUpdate() + { $input = $this->_input; @@ -200,7 +207,7 @@ class IndexFarmer extends ApiRest $input['uniacid'] = $this->_uniacid; - $res = $this->land_model->dataUpdate($dis,$input); + $res = $this->land_model->dataUpdate($dis, $input); return $this->success($res); @@ -212,7 +219,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-10 18:05 * @功能说明:编辑土地 */ - public function landStatusUpdate(){ + public function landStatusUpdate() + { $input = $this->_input; @@ -229,14 +237,13 @@ class IndexFarmer extends ApiRest } - - /** * @author chenniang * @DataTime: 2021-12-10 18:05 * @功能说明:土地详情 */ - public function landInfo(){ + public function landInfo() + { $input = $this->_param; @@ -258,19 +265,20 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 14:43 * @功能说明:地块列表 */ - public function massifList(){ + public function massifList() + { $input = $this->_param; - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','>',-1]; + $dis[] = ['status', '>', -1]; - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } $data = $this->massif_model->dataList($dis); @@ -285,19 +293,20 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 14:43 * @功能说明:地块列表下拉框 */ - public function massifSelect(){ + public function massifSelect() + { $input = $this->_param; - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','=',1]; + $dis[] = ['status', '=', 1]; - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } $data = $this->massif_model->where($dis)->select()->toArray(); @@ -311,7 +320,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 14:49 * @功能说明:添加地块 */ - public function massifAdd(){ + public function massifAdd() + { $input = $this->_input; @@ -333,7 +343,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 14:50 * @功能说明:编辑地块 */ - public function massifUpdate(){ + public function massifUpdate() + { $input = $this->_input; @@ -344,31 +355,31 @@ class IndexFarmer extends ApiRest $input['uniacid'] = $this->_uniacid; //删除 - if(isset($input['status'])&&$input['status']==-1){ + if (isset($input['status']) && $input['status'] == -1) { - $find = $this->land_model->landSomeFind($input['id'],1); + $find = $this->land_model->landSomeFind($input['id'], 1); - if($find==1){ + if ($find == 1) { $this->errorMsg('该地块服务正在被使用'); } } - $data = $this->massif_model->dataUpdate($dis,$input); + $data = $this->massif_model->dataUpdate($dis, $input); return $this->success($data); } - /** * @author chenniang * @DataTime: 2021-12-14 14:50 * @功能说明:地块详情 */ - public function massifInfo(){ + public function massifInfo() + { $input = $this->_param; @@ -389,30 +400,31 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-20 16:54 * @功能说明:种子列表 */ - public function seedList(){ + public function seedList() + { $input = $this->_param; - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','>',-1]; + $dis[] = ['status', '>', -1]; - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } $seed_model = new Seed(); - $data = $seed_model->dataList($dis,10); + $data = $seed_model->dataList($dis, 10); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i:s', $v['create_time']); } } @@ -426,19 +438,20 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-20 16:54 * @功能说明:种子列表 */ - public function seedSelect(){ + public function seedSelect() + { $input = $this->_param; - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','=',1]; + $dis[] = ['status', '=', 1]; - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } $seed_model = new Seed(); @@ -448,12 +461,14 @@ class IndexFarmer extends ApiRest return $this->success($data); } + /** * @author chenniang * @DataTime: 2021-12-20 16:57 * @功能说明:添加种子 */ - public function seedAdd(){ + public function seedAdd() + { $input = $this->_input; @@ -472,14 +487,13 @@ class IndexFarmer extends ApiRest } - - /** * @author chenniang * @DataTime: 2021-12-14 14:50 * @功能说明:编辑种子 */ - public function seedUpdate(){ + public function seedUpdate() + { $input = $this->_input; @@ -492,18 +506,18 @@ class IndexFarmer extends ApiRest $seed_model = new Seed(); //删除 - if(isset($input['status'])&&in_array($input['status'],[-1,0])){ + if (isset($input['status']) && in_array($input['status'], [-1, 0])) { - $find = $this->land_model->landSomeFind($input['id'],2); + $find = $this->land_model->landSomeFind($input['id'], 2); - if($find==1){ + if ($find == 1) { $this->errorMsg('该种子正在被使用'); } } - $data = $seed_model->dataUpdate($dis,$input); + $data = $seed_model->dataUpdate($dis, $input); return $this->success($data); @@ -515,7 +529,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 14:50 * @功能说明:编辑种子 */ - public function seedInfo(){ + public function seedInfo() + { $input = $this->_param; @@ -538,30 +553,30 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 15:28 * @功能说明:认养管理列表 */ - public function claimList(){ - - $input = $this->_param; - + public function claimList() + { + echo 1;die; + $input = $this->_param; $claim_model = new Claim(); - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','>',-1]; + $dis[] = ['status', '>', -1]; - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } - $data = $claim_model->dataList($dis,10); + $data = $claim_model->dataList($dis, 10); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i:s', $v['create_time']); } @@ -577,7 +592,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 16:32 * @功能说明:添加认养 */ - public function claimAdd(){ + public function claimAdd() + { $input = $this->_input; @@ -601,7 +617,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 16:32 * @功能说明:认养详情 */ - public function claimInfo(){ + public function claimInfo() + { $input = $this->_param; @@ -614,31 +631,31 @@ class IndexFarmer extends ApiRest $res = $claim_model->dataInfo($dis); - $claim_text_model = new ClaimText(); + $claim_text_model = new ClaimText(); - $monitor_text_model= new MonitorText(); + $monitor_text_model = new MonitorText(); - $monitor_model = new Monitor(); + $monitor_model = new Monitor(); //流程 - $res['process'] = $claim_text_model->where(['claim_id'=>$input['id']])->select()->toArray(); + $res['process'] = $claim_text_model->where(['claim_id' => $input['id']])->select()->toArray(); //监控 - $res['monitor'] = $monitor_text_model->where(['obj_id'=>$input['id'],'type'=>2])->column('monitor_id'); + $res['monitor'] = $monitor_text_model->where(['obj_id' => $input['id'], 'type' => 2])->column('monitor_id'); $res['monitor'] = array_values($res['monitor']); - $res['monitor'] = $monitor_model->where('id','in',$res['monitor'])->where(['status'=>1])->select()->toArray(); + $res['monitor'] = $monitor_model->where('id', 'in', $res['monitor'])->where(['status' => 1])->select()->toArray(); $cate_model = new LandCate(); //分类名字 - $res['cate_name'] = $cate_model->where(['id'=>$res['cate_id'],'type'=>2])->value('title'); + $res['cate_name'] = $cate_model->where(['id' => $res['cate_id'], 'type' => 2])->value('title'); $source_model = new Source(); //溯源名字 - $res['source_name'] = $source_model->where(['id'=>$res['source_id']])->value('title'); + $res['source_name'] = $source_model->where(['id' => $res['source_id']])->value('title'); $mac_model = new Machine(); //仪器名字 - $res['machine_name'] = $mac_model->where(['id'=>$res['machine_id'],'status'=>1])->value('title'); + $res['machine_name'] = $mac_model->where(['id' => $res['machine_id'], 'status' => 1])->value('title'); return $this->success($res); @@ -650,7 +667,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 16:32 * @功能说明:编辑认养 */ - public function claimUpdate(){ + public function claimUpdate() + { $input = $this->_input; @@ -663,7 +681,7 @@ class IndexFarmer extends ApiRest $claim_model = new Claim(); - $res = $claim_model->dataUpdate($dis,$input); + $res = $claim_model->dataUpdate($dis, $input); return $this->success($res); @@ -675,7 +693,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 16:32 * @功能说明:编辑认养 */ - public function claimStatusUpdate(){ + public function claimStatusUpdate() + { $input = $this->_input; @@ -698,7 +717,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 17:04 * @功能说明:溯源列表 */ - public function sourceList(){ + public function sourceList() + { $input = $this->_param; @@ -706,24 +726,24 @@ class IndexFarmer extends ApiRest // $source_text_model = new SourceText(); - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','>',-1]; + $dis[] = ['status', '>', -1]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; - $data = $source_model->dataList($dis,10); + $data = $source_model->dataList($dis, 10); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i:s', $v['create_time']); } } @@ -736,22 +756,23 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 17:04 * @功能说明:溯源下拉框 */ - public function sourceSelect(){ + public function sourceSelect() + { $input = $this->_param; $source_model = new Source(); - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','=',1]; + $dis[] = ['status', '=', 1]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; $data = $source_model->where($dis)->select()->toArray(); @@ -763,7 +784,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 17:10 * @功能说明:添加溯源 */ - public function sourceAdd(){ + public function sourceAdd() + { $input = $this->_input; @@ -787,7 +809,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 17:12 * @功能说明:编辑溯源 */ - public function sourceUpdate(){ + public function sourceUpdate() + { $input = $this->_input; @@ -800,18 +823,18 @@ class IndexFarmer extends ApiRest 'id' => $input['id'] ]; //删除 - if(isset($input['status'])&&$input['status']==-1){ + if (isset($input['status']) && $input['status'] == -1) { - $find = $this->land_model->landSomeFind($input['id'],3); + $find = $this->land_model->landSomeFind($input['id'], 3); - if($find==1){ + if ($find == 1) { $this->errorMsg('该溯源正在被使用'); } } - $res = $source_model->dataUpdate($dis,$input); + $res = $source_model->dataUpdate($dis, $input); return $this->success($res); @@ -823,7 +846,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-14 17:12 * @功能说明:编辑溯源 */ - public function sourceInfo(){ + public function sourceInfo() + { $input = $this->_param; @@ -846,24 +870,25 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-29 10:29 * @功能说明:养殖管理 */ - public function breedList(){ + public function breedList() + { $input = $this->_param; $breed_model = new Breed(); - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','>',-1]; + $dis[] = ['status', '>', -1]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; - $data = $breed_model->dataList($dis,10); + $data = $breed_model->dataList($dis, 10); return $this->success($data); @@ -875,7 +900,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-29 10:30 * @功能说明:添加养殖管理 */ - public function breedAdd(){ + public function breedAdd() + { $input = $this->_input; @@ -897,7 +923,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-29 10:34 * @功能说明:编辑养殖管理 */ - public function breedUpdate(){ + public function breedUpdate() + { $input = $this->_input; @@ -910,7 +937,7 @@ class IndexFarmer extends ApiRest $breed_model = new Breed(); - $res = $breed_model->dataUpdate($dis,$input); + $res = $breed_model->dataUpdate($dis, $input); return $this->success($res); @@ -922,7 +949,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-29 10:34 * @功能说明:编辑养殖管理 */ - public function breedInfo(){ + public function breedInfo() + { $input = $this->_param; @@ -945,7 +973,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-30 11:15 * @功能说明:申请提现 */ - public function applyWallet(){ + public function applyWallet() + { $input = $this->_input; @@ -953,9 +982,9 @@ class IndexFarmer extends ApiRest $config_model = new Config(); - $config = $config_model->dataInfo(['uniacid'=>$this->_uniacid]); + $config = $config_model->dataInfo(['uniacid' => $this->_uniacid]); - if($input['apply_price']>$this->farmer['cash']){ + if ($input['apply_price'] > $this->farmer['cash']) { $this->errorMsg('余额不足'); } @@ -964,26 +993,26 @@ class IndexFarmer extends ApiRest $insert = [ - 'uniacid' => $this->_uniacid, + 'uniacid' => $this->_uniacid, - 'user_id' => $this->getUserId(), + 'user_id' => $this->getUserId(), 'order_code' => orderCode(), - 'farmer_id' => $this->farmer['id'], + 'farmer_id' => $this->farmer['id'], - 'pay_price' => $input['apply_price'], + 'pay_price' => $input['apply_price'], - 'text' => $input['text'], + 'text' => $input['text'], - 'true_price' => round($input['apply_price']*$config['cash_balance']/100,2), + 'true_price' => round($input['apply_price'] * $config['cash_balance'] / 100, 2), - 'balance' => $config['cash_balance'], + 'balance' => $config['cash_balance'], ]; //发起提现 $res = $wallet_model->dataAdd($insert); - if($res==0){ + if ($res == 0) { Db::rollback(); @@ -995,9 +1024,9 @@ class IndexFarmer extends ApiRest $id = $wallet_model->getLastInsID(); //添加拒绝提现记录 - $res = $water_model->addWater($id,7,1,1); + $res = $water_model->addWater($id, 7, 1, 1); - if($res==0){ + if ($res == 0) { Db::rollback(); @@ -1007,7 +1036,7 @@ class IndexFarmer extends ApiRest //执行记录 $res = $water_model->cashArrival($this->farmer['id']); - if($res==0){ + if ($res == 0) { Db::rollback(); @@ -1027,21 +1056,22 @@ class IndexFarmer extends ApiRest * @DataTime: 2022-02-09 15:06 * @功能说明:农场主财务详情 */ - public function farmerFinanceInfo(){ + public function farmerFinanceInfo() + { $water_model = new FinanceWater(); $water_model->cashArrival($this->farmer['id']); //余额 - $data['cash'] = $this->model->where(['id'=>$this->farmer['id']])->value('cash'); + $data['cash'] = $this->model->where(['id' => $this->farmer['id']])->value('cash'); $water_data = $water_model->getDayCash($this->farmer['id']); //总金额 $data['total_cash'] = $water_data['income_cash']; //冻结金额 - $data['frozen_cash']= $water_model->where(['farmer_id'=>$this->farmer['id'],'add'=>1,'role_type'=>1])->where('cash_status','in',[0,1])->sum('price'); + $data['frozen_cash'] = $water_model->where(['farmer_id' => $this->farmer['id'], 'add' => 1, 'role_type' => 1])->where('cash_status', 'in', [0, 1])->sum('price'); - $data['frozen_cash']= round($data['frozen_cash'],2); + $data['frozen_cash'] = round($data['frozen_cash'], 2); return $this->success($data); @@ -1053,28 +1083,29 @@ class IndexFarmer extends ApiRest * @DataTime: 2022-02-09 16:35 * @功能说明:农场主流水记录 */ - public function farmerFinanceList(){ + public function farmerFinanceList() + { $input = $this->_param; - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; - $dis[] = ['role_type','=',1]; + $dis[] = ['role_type', '=', 1]; - if(isset($input['add'])){ + if (isset($input['add'])) { - $dis[] = ['add','=',$input['add']]; + $dis[] = ['add', '=', $input['add']]; } - if(!empty($input['start_time'])&&!empty($input['end_time'])){ + if (!empty($input['start_time']) && !empty($input['end_time'])) { - $dis[] = ['create_time','between',"{$input['start_time']},{$input['end_time']}"]; + $dis[] = ['create_time', 'between', "{$input['start_time']},{$input['end_time']}"]; } $water_model = new FinanceWater(); - $data = $water_model->dataList($dis,10); + $data = $water_model->dataList($dis, 10); return $this->success($data); @@ -1086,7 +1117,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-30 17:09 * @功能说明:农场主提现列表 */ - public function walletList(){ + public function walletList() + { $input = $this->_param; @@ -1094,13 +1126,13 @@ class IndexFarmer extends ApiRest 'farmer_id' => $this->farmer['id'], - 'is_show' => 1, + 'is_show' => 1, - 'uniacid' => $this->_uniacid + 'uniacid' => $this->_uniacid ]; - if(!empty($input['status'])){ + if (!empty($input['status'])) { $dis['status'] = $input['status']; } @@ -1119,7 +1151,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-31 15:11 * @功能说明:认养和土地分类 */ - public function landAndClaimCate(){ + public function landAndClaimCate() + { $input = $this->_param; @@ -1127,9 +1160,9 @@ class IndexFarmer extends ApiRest 'a.status' => 1, - 'a.uniacid'=> $this->_uniacid, + 'a.uniacid' => $this->_uniacid, - 'a.type' => $input['type'] + 'a.type' => $input['type'] ]; $where = [ @@ -1142,23 +1175,22 @@ class IndexFarmer extends ApiRest $cate_model = new LandCate(); $data = $cate_model->alias('a') - ->join('lbfarm_land_cate_text b','a.id = b.cate_id','left') - ->where($dis) - ->where(function ($query) use ($where){ - $query->whereOr($where); - }) - ->field('a.*') - ->group('a.id') - ->order('a.top desc,a.id desc') - ->select() - ->toArray(); + ->join('lbfarm_land_cate_text b', 'a.id = b.cate_id', 'left') + ->where($dis) + ->where(function ($query) use ($where) { + $query->whereOr($where); + }) + ->field('a.*') + ->group('a.id') + ->order('a.top desc,a.id desc') + ->select() + ->toArray(); return $this->success($data); } - /** * @author chenniang * @DataTime: 2022-01-10 15:52 @@ -1166,13 +1198,14 @@ class IndexFarmer extends ApiRest * */ - public function breedOrderList(){ + public function breedOrderList() + { $input = $this->_param; - $dis[] = ['pay_type','>',1]; + $dis[] = ['pay_type', '>', 1]; - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; $order_model = new BreedOrder(); @@ -1188,33 +1221,34 @@ class IndexFarmer extends ApiRest * @DataTime: 2022-02-09 15:16 * @功能说明:认养订单 */ - public function claimOrderList(){ + public function claimOrderList() + { $input = $this->_param; $order_model = new ClaimOrder(); - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; - if(!empty($input['pay_type'])){ + if (!empty($input['pay_type'])) { - $dis[] = ['pay_type','=',$input['pay_type']]; + $dis[] = ['pay_type', '=', $input['pay_type']]; - }else{ + } else { - $dis[] = ['pay_type','>',-1]; + $dis[] = ['pay_type', '>', -1]; } $data = $order_model->dataList($dis); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - $address_model = new OrderAddress(); + $address_model = new OrderAddress(); - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { //地址信息 - $v['address_info'] = $address_model->dataInfo(['order_id'=>$v['id'],'type'=>2]); + $v['address_info'] = $address_model->dataInfo(['order_id' => $v['id'], 'type' => 2]); } } @@ -1225,16 +1259,16 @@ class IndexFarmer extends ApiRest 3 => 'send_ing' ]; - foreach ($arr as $k=>$value){ + foreach ($arr as $k => $value) { $dis = [ 'pay_type' => $k, - 'farmer_id'=> $this->farmer['id'] + 'farmer_id' => $this->farmer['id'] ]; - $data[$value] = $order_model->where($dis)->where('pay_time','>',0)->count(); + $data[$value] = $order_model->where($dis)->where('pay_time', '>', 0)->count(); } return $this->success($data); @@ -1243,26 +1277,26 @@ class IndexFarmer extends ApiRest } - /** * @author chenniang * @DataTime: 2022-02-09 09:47 * @功能说明:发货订单发货 */ - public function sendOrderSend(){ + public function sendOrderSend() + { $input = $this->_input; $send_order_model = new SendOrder(); - $send_order = $send_order_model->dataInfo(['id'=>$input['id']]); + $send_order = $send_order_model->dataInfo(['id' => $input['id']]); - if(empty($send_order)){ + if (empty($send_order)) { $this->errorMsg('订单未找到'); } - if($send_order['pay_type']!=2){ + if ($send_order['pay_type'] != 2) { $this->errorMsg('订单状态错误'); } @@ -1271,28 +1305,28 @@ class IndexFarmer extends ApiRest 'pay_type' => 3, - 'send_time'=> time(), + 'send_time' => time(), - 'auto_receiving_time' => $this->_config['auto_hx_time']*86400+time() + 'auto_receiving_time' => $this->_config['auto_hx_time'] * 86400 + time() ]; Db::startTrans(); - $res = $send_order_model->dataUpdate(['id'=>$input['id']],$update); + $res = $send_order_model->dataUpdate(['id' => $input['id']], $update); - if($res==0){ + if ($res == 0) { Db::rollback(); $this->errorMsg('发货失败'); } - if($send_order['type']==1){ + if ($send_order['type'] == 1) { $claim_order_model = new ClaimOrder(); - $claim_order_model->dataUpdate(['id'=>$send_order['order_id']],['pay_type'=>3]); + $claim_order_model->dataUpdate(['id' => $send_order['order_id']], ['pay_type' => 3]); } Db::commit(); @@ -1302,44 +1336,44 @@ class IndexFarmer extends ApiRest } - /** * @author chenniang * @DataTime: 2022-02-08 17:14 * @功能说明:配送订单列表 */ - public function farmerSendOrderList(){ + public function farmerSendOrderList() + { $input = $this->_param; - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; - $dis[] = ['pay_time','>',0]; + $dis[] = ['pay_time', '>', 0]; - if(!empty($input['pay_type'])){ + if (!empty($input['pay_type'])) { - $dis[] = ['pay_type','=',$input['pay_type']]; + $dis[] = ['pay_type', '=', $input['pay_type']]; } $send_order_model = new SendOrder(); $data = $send_order_model->dataList($dis); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { - $v['time_text'] = date('Y-m-d H:i',$v['start_time']).'~'.date('H:i',$v['end_time']); + $v['time_text'] = date('Y-m-d H:i', $v['start_time']) . '~' . date('H:i', $v['end_time']); - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i:s', $v['create_time']); - $v['pay_time'] = $v['pay_time']>0?date('Y-m-d H:i:s',$v['pay_time']):0; + $v['pay_time'] = $v['pay_time'] > 0 ? date('Y-m-d H:i:s', $v['pay_time']) : 0; - $v['send_time'] = $v['send_time']>0?date('Y-m-d H:i:s',$v['send_time']):0; + $v['send_time'] = $v['send_time'] > 0 ? date('Y-m-d H:i:s', $v['send_time']) : 0; - $v['receiving_time'] = $v['receiving_time']>0?date('Y-m-d H:i:s',$v['receiving_time']):0; + $v['receiving_time'] = $v['receiving_time'] > 0 ? date('Y-m-d H:i:s', $v['receiving_time']) : 0; - $v['refund_time'] = $v['refund_time']>0?date('Y-m-d H:i:s',$v['refund_time']):0; + $v['refund_time'] = $v['refund_time'] > 0 ? date('Y-m-d H:i:s', $v['refund_time']) : 0; } } @@ -1350,16 +1384,16 @@ class IndexFarmer extends ApiRest 3 => 'send_ing' ]; - foreach ($arr as $k=>$value){ + foreach ($arr as $k => $value) { $dis = [ 'pay_type' => $k, - 'farmer_id'=> $this->farmer['id'] + 'farmer_id' => $this->farmer['id'] ]; - $data[$value] = $send_order_model->where($dis)->where('pay_time','>',0)->count(); + $data[$value] = $send_order_model->where($dis)->where('pay_time', '>', 0)->count(); } return $this->success($data); @@ -1367,33 +1401,33 @@ class IndexFarmer extends ApiRest } - /** * @author chenniang * @DataTime: 2022-02-09 09:47 * @功能说明:配送订单收货 */ - public function sendOrderPickup(){ + public function sendOrderPickup() + { $input = $this->_input; $send_order_model = new SendOrder(); - $send_order = $send_order_model->dataInfo(['id'=>$input['id']]); + $send_order = $send_order_model->dataInfo(['id' => $input['id']]); - if(empty($send_order)){ + if (empty($send_order)) { $this->errorMsg('订单未找到'); } - if($send_order['pay_type']!=2){ + if ($send_order['pay_type'] != 2) { $this->errorMsg('订单状态错误'); } $res = $send_order_model->sendOrderReceiving($send_order); - if(!empty($res['code'])){ + if (!empty($res['code'])) { $this->errorMsg($res['msg']); } @@ -1408,62 +1442,63 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-12-28 11:26 * @功能说明:用户下单列表 */ - public function landOrderList(){ + public function landOrderList() + { $input = $this->_param; - $order_model = new LandOrder(); + $order_model = new LandOrder(); $farmer_model = new Farmer(); $order_model->orderInit($this->getUserId()); - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; - if(!empty($input['pay_type'])){ + if (!empty($input['pay_type'])) { - $dis[] = ['pay_type','=',$input['pay_type']]; + $dis[] = ['pay_type', '=', $input['pay_type']]; - }else{ + } else { - $dis[] = ['pay_type','>',-1]; + $dis[] = ['pay_type', '>', -1]; } - if(!empty($input['order_code'])){ + if (!empty($input['order_code'])) { - $dis[] = ['order_code','like','%'.$input['order_code'].'%']; + $dis[] = ['order_code', 'like', '%' . $input['order_code'] . '%']; } $data = $order_model->dataList($dis); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - $address_model = new OrderAddress(); + $address_model = new OrderAddress(); - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { - $v['farmer_info'] = $farmer_model->dataInfo(['id'=>$v['farmer_id']],'title'); + $v['farmer_info'] = $farmer_model->dataInfo(['id' => $v['farmer_id']], 'title'); - $v['end_time'] = date('Y-m-d H:i:s',$v['end_time']); + $v['end_time'] = date('Y-m-d H:i:s', $v['end_time']); //地址信息 - $v['address_info'] = $address_model->dataInfo(['order_id'=>$v['id'],'type'=>1]); + $v['address_info'] = $address_model->dataInfo(['order_id' => $v['id'], 'type' => 1]); } } - $arr = [1=>'no_pay_count',2=>'rent_count',3=>'send_count']; + $arr = [1 => 'no_pay_count', 2 => 'rent_count', 3 => 'send_count']; - foreach ($arr as $key => $value){ + foreach ($arr as $key => $value) { $where = [ 'farmer_id' => $this->farmer['id'], - 'pay_type' => $key + 'pay_type' => $key ]; $data['count'][$value] = $order_model->where($where)->count(); @@ -1475,23 +1510,23 @@ class IndexFarmer extends ApiRest } - /** * @author chenniang * @DataTime: 2022-02-21 11:00 * @功能说明:仪器列表 */ - public function machineSelect(){ + public function machineSelect() + { $input = $this->_param; $mac_model = new Machine(); - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','=',1]; + $dis[] = ['status', '=', 1]; - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; $data = $mac_model->where($dis)->select()->toArray(); @@ -1505,23 +1540,24 @@ class IndexFarmer extends ApiRest * @DataTime: 2022-02-22 17:11 * @功能说明:生成二维码 */ - public function getSourceQr(){ + public function getSourceQr() + { $input = $this->_input; $uniacid = $this->_uniacid; - $key = 'sourcekey'.$input['id']; + $key = 'sourcekey' . $input['id']; - $qr = getCache($key,$uniacid); + $qr = getCache($key, $uniacid); - if(empty($qr)||!empty($input['is_update'])){ + if (empty($qr) || !empty($input['is_update'])) { - $data = longbingCreateWxCode($uniacid,$input,$input['page']); + $data = longbingCreateWxCode($uniacid, $input, $input['page']); - $data = transImagesOne($data ,['qr_path'] ,$uniacid); + $data = transImagesOne($data, ['qr_path'], $uniacid); - $qr = $data['qr_path']; + $qr = $data['qr_path']; } return $this->success($qr); @@ -1529,63 +1565,60 @@ class IndexFarmer extends ApiRest } - - - - /** * @author chenniang * @DataTime: 2022-03-01 11:03 * @功能说明:订单列表 */ - public function shopOrderList(){ + public function shopOrderList() + { $input = $this->_param; - $dis[] = ['a.uniacid','=',$this->_uniacid]; + $dis[] = ['a.uniacid', '=', $this->_uniacid]; - $dis[] = ['a.farmer_id','=',$this->farmer['id']]; + $dis[] = ['a.farmer_id', '=', $this->farmer['id']]; - $dis[] = ['a.farmer_show','=',1]; + $dis[] = ['a.farmer_show', '=', 1]; $where = []; - if(!empty($input['name'])){ + if (!empty($input['name'])) { - $where[] = ['b.goods_name','like','%'.$input['name'].'%']; + $where[] = ['b.goods_name', 'like', '%' . $input['name'] . '%']; - $where[] = ['a.order_code','like','%'.$input['name'].'%']; + $where[] = ['a.order_code', 'like', '%' . $input['name'] . '%']; } - if(!empty($input['pay_type'])){ + if (!empty($input['pay_type'])) { - $dis[] = ['a.pay_type','=',$input['pay_type']]; + $dis[] = ['a.pay_type', '=', $input['pay_type']]; - }else{ + } else { - $dis[] = ['a.pay_type','>',1]; + $dis[] = ['a.pay_type', '>', 1]; } $order_model = new ShopOrder(); - $data = $order_model->indexDataList($dis,$where); + $data = $order_model->indexDataList($dis, $where); $arr = [ //未发货 - 'no_send_count' => 2, + 'no_send_count' => 2, //已经发货 - 'have_send_count'=> 3 + 'have_send_count' => 3 ]; - foreach ($arr as $ks=>$vs){ + foreach ($arr as $ks => $vs) { $map = [ - 'farmer_id'=> $this->farmer['id'], + 'farmer_id' => $this->farmer['id'], - 'pay_type'=> $vs, + 'pay_type' => $vs, 'farmer_show' => 1 ]; @@ -1603,7 +1636,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2021-03-15 14:58 * @功能说明:订单详情 */ - public function shopOrderInfo(){ + public function shopOrderInfo() + { $input = $this->_param; @@ -1619,23 +1653,23 @@ class IndexFarmer extends ApiRest $data['over_time'] -= time(); - $time_arr = ['create_time','pay_time','end_time','hx_time','over_time','cancel_time']; + $time_arr = ['create_time', 'pay_time', 'end_time', 'hx_time', 'over_time', 'cancel_time']; - foreach ($time_arr as $v){ + foreach ($time_arr as $v) { - $data[$v] = !empty($data[$v])?date('Y-m-d H:i:s',$data[$v]):$data[$v]; + $data[$v] = !empty($data[$v]) ? date('Y-m-d H:i:s', $data[$v]) : $data[$v]; } $data['distance'] = distance_text($data['distance']); - $end_time = date('H:i',$data['send_end_time'])=='00:00'?'24:00':date('H:i',$data['send_end_time']); + $end_time = date('H:i', $data['send_end_time']) == '00:00' ? '24:00' : date('H:i', $data['send_end_time']); //配送时间 - $data['user_send_time'] = date('Y-m-d H:i',$data['send_start_time']).'~'.$end_time; + $data['user_send_time'] = date('Y-m-d H:i', $data['send_start_time']) . '~' . $end_time; $farmer_model = new Farmer(); - $data['farmer_info'] = $farmer_model->dataInfo(['id'=>$data['farmer_id']],'title'); + $data['farmer_info'] = $farmer_model->dataInfo(['id' => $data['farmer_id']], 'title'); return $this->success($data); @@ -1647,7 +1681,8 @@ class IndexFarmer extends ApiRest * @DataTime: 2022-03-07 11:08 * @功能说明:地主商城订单发货 */ - public function shopOrderSend(){ + public function shopOrderSend() + { $input = $this->_input; @@ -1660,15 +1695,15 @@ class IndexFarmer extends ApiRest $order = $order_model->dataInfo($dis); - if(empty($order)||$order['pay_type']!=2){ + if (empty($order) || $order['pay_type'] != 2) { $this->errorMsg('订单状态错误'); } $refund_model = new ShopRefund(); //判断有无申请中的退款订单 - $refund_order = $refund_model->dataInfo(['order_id'=>$input['id'],'status'=>1]); + $refund_order = $refund_model->dataInfo(['order_id' => $input['id'], 'status' => 1]); - if(!empty($refund_order)){ + if (!empty($refund_order)) { $this->errorMsg('该订单正在申请退款,请先处理再核销'); @@ -1676,7 +1711,7 @@ class IndexFarmer extends ApiRest $config_model = new Config(); - // $config = $config_model->dataInfo(['uniacid'=>$this->_uniacid]); + // $config = $config_model->dataInfo(['uniacid'=>$this->_uniacid]); $update = [ @@ -1690,15 +1725,15 @@ class IndexFarmer extends ApiRest // // 'express_user' => $input['express_user'], - // 'send_time' => time(), + // 'send_time' => time(), - 'video' => $input['video'], + 'video' => $input['video'], //'hx_over_time' => time()+$config['auto_hx_time']*86400, ]; - $data = $order_model->dataUpdate($dis,$update); + $data = $order_model->dataUpdate($dis, $update); // $water_model = new FinanceWater(); // //商城订单农场主获得运费 @@ -1714,26 +1749,26 @@ class IndexFarmer extends ApiRest } - /** * @author chenniang * @DataTime: 2022-04-11 14:22 * @功能说明:监控列表 */ - public function monitorSelect(){ + public function monitorSelect() + { $input = $this->_param; - $dis[] = ['uniacid','=',$this->_uniacid]; + $dis[] = ['uniacid', '=', $this->_uniacid]; - $dis[] = ['status','=',1]; + $dis[] = ['status', '=', 1]; - if(!empty($input['title'])){ + if (!empty($input['title'])) { - $dis[] = ['title','like','%'.$input['title'].'%']; + $dis[] = ['title', 'like', '%' . $input['title'] . '%']; } - $dis[] = ['farmer_id','=',$this->farmer['id']]; + $dis[] = ['farmer_id', '=', $this->farmer['id']]; $monitor_model = new Monitor(); @@ -1744,8 +1779,4 @@ class IndexFarmer extends ApiRest } - - - - } diff --git a/app/farm/controller/IndexGoods.php b/app/farm/controller/IndexGoods.php index 67df423..2d6fbe0 100644 --- a/app/farm/controller/IndexGoods.php +++ b/app/farm/controller/IndexGoods.php @@ -1,5 +1,7 @@ _param; - - $dis[] = ['uniacid','=',$this->_uniacid]; - - $dis[] = ['status','=',2]; - - $dis[] = ['business_status','=',1]; - - if(!empty($input['store_name'])){ - - $dis[] = ['title','like','%'.$input['store_name'].'%']; + $page = $input['page'] ?? 10; + $dis[] = ['uniacid', '=', $this->_uniacid]; + $dis[] = ['status', '=', 2]; + $dis[] = ['business_status', '=', 1]; + if (!empty($input['store_name'])) { + $dis[] = ['title', 'like', '%' . $input['store_name'] . '%']; } - $lat = !empty($input['lat'])?$input['lat']:0; - - $lng = !empty($input['lng'])?$input['lng']:0; - - $alh = '(2 * 6378.137* ASIN(SQRT(POW(SIN(3.1415926535898*('.$lat.'-lat)/360),2)+COS(3.1415926535898*'.$lat.'/180)* COS('.$lat.' * 3.1415926535898/180)*POW(SIN(3.1415926535898*('.$lng.'-lng)/360),2))))*1000 as distance'; - - $alhs = '(2 * 6378.137* ASIN(SQRT(POW(SIN(3.1415926535898*('.$lat.'-lat)/360),2)+COS(3.1415926535898*'.$lat.'/180)* COS('.$lat.' * 3.1415926535898/180)*POW(SIN(3.1415926535898*('.$lng.'-lng)/360),2))))*1000<20000'; - + $lat = !empty($input['lat']) ? $input['lat'] : 0; + $lng = !empty($input['lng']) ? $input['lng'] : 0; + $alh = '(2 * 6378.137* ASIN(SQRT(POW(SIN(3.1415926535898*(' . $lat . '-lat)/360),2)+COS(3.1415926535898*' . $lat . '/180)* COS(' . $lat . ' * 3.1415926535898/180)*POW(SIN(3.1415926535898*(' . $lng . '-lng)/360),2))))*1000 as distance'; + $alhs = '(2 * 6378.137* ASIN(SQRT(POW(SIN(3.1415926535898*(' . $lat . '-lat)/360),2)+COS(3.1415926535898*' . $lat . '/180)* COS(' . $lat . ' * 3.1415926535898/180)*POW(SIN(3.1415926535898*(' . $lng . '-lng)/360),2))))*1000<20000'; $store_model = new Farmer(); - $data = $store_model->dataDistanceList($dis,$alh,$alhs,10); + $data = $store_model->dataDistanceList($dis, $alh, $alhs, $page); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { - $v['distance'] = getDistances($v['lng'],$v['lat'],$lng,$lat); + $v['distance'] = getDistances($v['lng'], $v['lat'], $lng, $lat); $v['distance'] = $store_model->getDistanceAttr($v['distance']); @@ -93,23 +86,22 @@ class IndexGoods extends ApiRest } return $this->success($data); - } - /** * @author chenniang * @DataTime: 2021-03-19 13:24 * @功能说明:选择门店 */ - public function selectStore(){ + public function selectStore() + { $input = $this->_input; $user_model = new User(); - $res = $user_model->dataUpdate(['id'=>$this->getUserId()],['last_store_id'=>$input['store_id']]); + $res = $user_model->dataUpdate(['id' => $this->getUserId()], ['last_store_id' => $input['store_id']]); return $this->success($res); @@ -121,19 +113,20 @@ class IndexGoods extends ApiRest * @DataTime: 2021-03-18 16:46 * @功能说明:分类列表 */ - public function goodsIndex(){ + public function goodsIndex() + { $input = $this->_param; - $store_id = !empty($input['store_id'])?$input['store_id']:0; + $store_id = !empty($input['store_id']) ? $input['store_id'] : 0; - $data['cate_id'] = $this->cate_model->shopCateList($this->_uniacid,$store_id); + $data['cate_id'] = $this->cate_model->shopCateList($this->_uniacid, $store_id); - if(!empty($store_id)){ + if (!empty($store_id)) { $store_model = new Farmer(); - $data['store_info'] = $store_model->dataInfo(['id'=>$store_id]); + $data['store_info'] = $store_model->dataInfo(['id' => $store_id]); } return $this->success($data); @@ -146,7 +139,8 @@ class IndexGoods extends ApiRest * @DataTime: 2022-03-01 13:47 * @功能说明: */ - public function haveSelectStoreId(){ + public function haveSelectStoreId() + { return $this->success($this->getStoreInfo()['id']); @@ -158,48 +152,49 @@ class IndexGoods extends ApiRest * @DataTime: 2022-02-22 15:27 * @功能说明:商品列表 */ - public function goodsList(){ + public function goodsList() + { $input = $this->_param; - $dis[] = ['a.uniacid','=',$this->_uniacid]; + $dis[] = ['a.uniacid', '=', $this->_uniacid]; - $dis[] = ['a.status','=',1]; + $dis[] = ['a.status', '=', 1]; - // $dis[] = ['a.index_show','=',1]; + // $dis[] = ['a.index_show','=',1]; - $dis[] = ['d.status','=',2]; + $dis[] = ['d.status', '=', 2]; - $dis[] = ['d.business_status','=',1]; + $dis[] = ['d.business_status', '=', 1]; - if(!empty($input['store_id'])){ + if (!empty($input['store_id'])) { - $dis[] = ['b.store_id','=',$input['store_id']]; + $dis[] = ['b.store_id', '=', $input['store_id']]; } - if(!empty($input['cate_id'])){ + if (!empty($input['cate_id'])) { - $dis[] = ['c.cate_id','=',$input['cate_id']]; + $dis[] = ['c.cate_id', '=', $input['cate_id']]; } - if(!empty($input['goods_name'])){ + if (!empty($input['goods_name'])) { - $dis[] = ['a.goods_name','like','%'.$input['goods_name'].'%']; + $dis[] = ['a.goods_name', 'like', '%' . $input['goods_name'] . '%']; } //商品信息 - $data = $this->model->indexGoodsList($dis,10); + $data = $this->model->indexGoodsList($dis, 10); - if(!empty($data['data'])){ + if (!empty($data['data'])) { - foreach ($data['data'] as &$v){ + foreach ($data['data'] as &$v) { $where = [ - 'type' => 5, + 'type' => 5, - 'user_id' => $this->getUserId() + 'user_id' => $this->getUserId() ]; $v['car_count'] = $this->car_model->where($where)->count(); @@ -213,13 +208,13 @@ class IndexGoods extends ApiRest } - /** * @author chenniang * @DataTime: 2021-03-19 15:46 * @功能说明:商品详情 */ - public function goodsInfo(){ + public function goodsInfo() + { $input = $this->_param; @@ -230,9 +225,9 @@ class IndexGoods extends ApiRest $data = $this->model->dataInfo($dis); - $farm_model = new Farmer(); + $farm_model = new Farmer(); - $where[] = ['id','in',$data['store']]; + $where[] = ['id', 'in', $data['store']]; $data['store_info'] = $farm_model->dataInfo($where); @@ -244,30 +239,30 @@ class IndexGoods extends ApiRest 'goods_id' => $input['id'], - 'status' => 1 + 'status' => 1 ]; - $data['spe_text'] = $spe_model->goodsSpe($where); + $data['spe_text'] = $spe_model->goodsSpe($where); $data['spe_price'] = $spe_price_model->goodsSpePrice($where); - $kill_model = new SeckillList(); + $kill_model = new SeckillList(); $integral_model = new IntegralList(); //秒杀活动 - $data['kill_list'] = $kill_model->atvIng($input['id'],0,2); + $data['kill_list'] = $kill_model->atvIng($input['id'], 0, 2); - if(!empty($data['spe_price'])){ + if (!empty($data['spe_price'])) { - foreach ($data['spe_price'] as &$v){ + foreach ($data['spe_price'] as &$v) { //查询是否有秒杀活动 - $v['kill_atv'] = $kill_model->atvIng($input['id'],$v['id']); + $v['kill_atv'] = $kill_model->atvIng($input['id'], $v['id']); - if(empty($v['kill_atv'])){ + if (empty($v['kill_atv'])) { //积分活动 - $v['integral_atv'] = $integral_model->atvIng($input['id'],$v['id']); + $v['integral_atv'] = $integral_model->atvIng($input['id'], $v['id']); - }else{ + } else { $v['integral_atv'] = []; } @@ -281,42 +276,40 @@ class IndexGoods extends ApiRest } - - /** * @author chenniang * @DataTime: 2021-03-24 14:07 * @功能说明:购物车信息 */ - public function carInfo(){ + public function carInfo() + { $input = $this->_param; - $store_id = !empty($input['store_id'])?$input['store_id']:0; + $store_id = !empty($input['store_id']) ? $input['store_id'] : 0; //购物车信息 - $car_info = $this->car_model->carPriceAndCount($this->getUserId(),$store_id,1); + $car_info = $this->car_model->carPriceAndCount($this->getUserId(), $store_id, 1); return $this->success($car_info); } - - /** * @author chenniang * @DataTime: 2021-03-24 14:46 * @功能说明:添加到购物车 */ - public function addCar(){ + public function addCar() + { $input = $this->_input; - $is_show_del = !empty($input['is_show_del'])?$input['is_show_del']:1; + $is_show_del = !empty($input['is_show_del']) ? $input['is_show_del'] : 1; - if($is_show_del==1){ + if ($is_show_del == 1) { - $this->car_model->where(['user_id'=>$this->getUserId(),'is_show'=>2])->delete(); + $this->car_model->where(['user_id' => $this->getUserId(), 'is_show' => 2])->delete(); } $insert = [ @@ -325,31 +318,31 @@ class IndexGoods extends ApiRest 'user_id' => $this->getUserId(), - 'farmer_id'=> $input['store_id'], + 'farmer_id' => $input['store_id'], - 'goods_id'=> $input['goods_id'], + 'goods_id' => $input['goods_id'], - 'spe_id' => $input['spe_id'], + 'spe_id' => $input['spe_id'], - 'type' => 5, + 'type' => 5, - 'is_show' => !empty($input['is_show'])?$input['is_show']:1, + 'is_show' => !empty($input['is_show']) ? $input['is_show'] : 1, ]; - $input['goods_num'] = !empty($input['goods_num'])?$input['goods_num']:1; + $input['goods_num'] = !empty($input['goods_num']) ? $input['goods_num'] : 1; $info = $this->car_model->dataInfo($insert); //增加数量 - if(!empty($info)){ + if (!empty($info)) { - $res = $this->car_model->dataUpdate(['id'=>$info['id']],['goods_num'=>$info['goods_num']+$input['goods_num']]); + $res = $this->car_model->dataUpdate(['id' => $info['id']], ['goods_num' => $info['goods_num'] + $input['goods_num']]); - }else{ + } else { //添加到购物车 $insert['goods_num'] = $input['goods_num']; - $insert['status'] = 1; + $insert['status'] = 1; $res = $this->car_model->dataAdd($insert); @@ -365,21 +358,22 @@ class IndexGoods extends ApiRest * @DataTime: 2021-03-24 14:54 * @功能说明:删除购物车 */ - public function delCar(){ + public function delCar() + { $input = $this->_input; - $info = $this->car_model->dataInfo(['id'=>$input['id']]); + $info = $this->car_model->dataInfo(['id' => $input['id']]); - $input['goods_num'] = !empty($input['goods_num'])?$input['goods_num']:1; + $input['goods_num'] = !empty($input['goods_num']) ? $input['goods_num'] : 1; //加少数量 - if($info['goods_num']>$input['goods_num']){ + if ($info['goods_num'] > $input['goods_num']) { - $res = $this->car_model->dataUpdate(['id'=>$info['id']],['goods_num'=>$info['goods_num']-$input['goods_num']]); + $res = $this->car_model->dataUpdate(['id' => $info['id']], ['goods_num' => $info['goods_num'] - $input['goods_num']]); - }else{ + } else { - $res = $this->car_model->where(['id'=>$info['id']])->delete(); + $res = $this->car_model->where(['id' => $info['id']])->delete(); } return $this->success($res); @@ -392,17 +386,18 @@ class IndexGoods extends ApiRest * @DataTime: 2021-03-25 10:39 * @功能说明: */ - public function carUpdate(){ + public function carUpdate() + { $input = $this->_input; - if(!empty($input['id'])){ + if (!empty($input['id'])) { - $res = $this->car_model->where('id','in',$input['id'])->update(['status'=>$input['status']]); + $res = $this->car_model->where('id', 'in', $input['id'])->update(['status' => $input['status']]); - }else{ + } else { - $res = $this->car_model->where('user_id','=',$this->getUserId())->update(['status'=>$input['status']]); + $res = $this->car_model->where('user_id', '=', $this->getUserId())->update(['status' => $input['status']]); } return $this->success($res); @@ -415,7 +410,8 @@ class IndexGoods extends ApiRest * @DataTime: 2021-03-24 14:59 * @功能说明:批量删除购物车 */ - public function delSomeCar(){ + public function delSomeCar() + { $input = $this->_input; @@ -425,9 +421,9 @@ class IndexGoods extends ApiRest 'user_id' => $this->getUserId(), - 'farmer_id'=> $this->getStoreInfo()['id'], + 'farmer_id' => $this->getStoreInfo()['id'], - 'type' => 5, + 'type' => 5, ]; diff --git a/app/farm/model/Farmer.php b/app/farm/model/Farmer.php index 16ef0e4..c88054e 100644 --- a/app/farm/model/Farmer.php +++ b/app/farm/model/Farmer.php @@ -1,4 +1,5 @@ time()){ + if ($start_time < time() && $end_time > time()) { return 1; - }else{ + } else { return 0; } @@ -47,11 +49,12 @@ class Farmer extends BaseModel * @DataTime: 2021-12-30 11:22 * @功能说明: */ - public function getImgsAttr($value,$data){ + public function getImgsAttr($value, $data) + { - if(!empty($value)){ + if (!empty($value)) { - return explode(',',$value); + return explode(',', $value); } } @@ -61,20 +64,23 @@ class Farmer extends BaseModel * @DataTime: 2021-12-30 11:22 * @功能说明: */ - public function getIdcardImgsAttr($value,$data){ + public function getIdcardImgsAttr($value, $data) + { - if(!empty($value)){ + if (!empty($value)) { - return explode(',',$value); + return explode(',', $value); } } + /** * @author chenniang * @DataTime: 2020-09-29 11:04 * @功能说明:添加 */ - public function dataAdd($data){ + public function dataAdd($data) + { $data['create_time'] = time(); @@ -85,13 +91,13 @@ class Farmer extends BaseModel } - /** * @author chenniang * @DataTime: 2020-09-29 11:05 * @功能说明:编辑 */ - public function dataUpdate($dis,$data){ + public function dataUpdate($dis, $data) + { $res = $this->where($dis)->update($data); @@ -105,7 +111,8 @@ class Farmer extends BaseModel * @DataTime: 2020-09-29 11:06 * @功能说明:列表 */ - public function dataList($dis,$page=10){ + public function dataList($dis, $page = 10) + { $data = $this->where($dis)->order('id desc')->paginate($page)->toArray(); @@ -119,9 +126,10 @@ class Farmer extends BaseModel * @DataTime: 2020-09-29 11:06 * @功能说明:列表 */ - public function dataDistanceList($dis,$alh,$alhs=[],$page=10){ + public function dataDistanceList($dis, $alh, $alhs = [], $page = 10) + { - $data = $this->where($dis)->where($alhs)->field(['*',$alh])->order('distance asc,id desc')->paginate($page)->toArray(); + $data = $this->where($dis)->where($alhs)->field(['*', $alh])->order('distance asc,id desc')->paginate($page)->toArray(); return $data; @@ -133,19 +141,20 @@ class Farmer extends BaseModel * @DataTime: 2021-12-30 11:26 * @功能说明:后台列表 */ - public function adminDataList($dis,$page=10,$where=[]){ + public function adminDataList($dis, $page = 10, $where = []) + { $data = $this->alias('a') - ->join('lbfarm_user_list b','a.user_id = b.id','left') - ->where($dis) - ->where(function ($query) use ($where){ - $query->whereOr($where); - }) - ->field('a.*,b.nickName,b.avatarUrl') - ->group('a.id') - ->order('a.id desc') - ->paginate($page) - ->toArray(); + ->join('lbfarm_user_list b', 'a.user_id = b.id', 'left') + ->where($dis) + ->where(function ($query) use ($where) { + $query->whereOr($where); + }) + ->field('a.*,b.nickName,b.avatarUrl') + ->group('a.id') + ->order('a.id desc') + ->paginate($page) + ->toArray(); return $data; @@ -157,11 +166,12 @@ class Farmer extends BaseModel * @DataTime: 2020-09-29 11:43 * @功能说明: */ - public function dataInfo($dis,$file='*'){ + public function dataInfo($dis, $file = '*') + { $data = $this->where($dis)->field($file)->find(); - return !empty($data)?$data->toArray():[]; + return !empty($data) ? $data->toArray() : []; } @@ -171,13 +181,14 @@ class Farmer extends BaseModel * @DataTime: 2022-02-22 11:30 * @功能说明:检查用户是否是地主 */ - public function landlordCheck($user_id){ + public function landlordCheck($user_id) + { - $cap_dis[] = ['user_id','=',$user_id]; + $cap_dis[] = ['user_id', '=', $user_id]; - $cap_dis[] = ['type','=',1]; + $cap_dis[] = ['type', '=', 1]; - $cap_dis[] = ['status','in',[2,3]]; + $cap_dis[] = ['status', 'in', [2, 3]]; $farmer_model = new \app\farm\model\Farmer(); //查看是否是团长 @@ -185,17 +196,17 @@ class Farmer extends BaseModel $is_landlord = 1; - if(empty($cap_info)){ + if (empty($cap_info)) { $order_model = new LandOrder(); - $where[] = ['pay_type','>',1]; + $where[] = ['pay_type', '>', 1]; - $where[] = ['user_id','=',$user_id]; + $where[] = ['user_id', '=', $user_id]; //是否有土地订单 $order = $order_model->dataInfo($where); - if(empty($order)){ + if (empty($order)) { $is_landlord = 0; @@ -205,7 +216,7 @@ class Farmer extends BaseModel $user_model = new User(); - $user_model->dataUpdate(['id'=>$user_id],['is_landlord'=>$is_landlord]); + $user_model->dataUpdate(['id' => $user_id], ['is_landlord' => $is_landlord]); return $is_landlord; } @@ -216,11 +227,12 @@ class Farmer extends BaseModel * @DataTime: 2022-02-22 11:53 * @功能说明:初始化地主表 */ - public function initLandLord($data,$uniacid){ + public function initLandLord($data, $uniacid) + { $dis = [ - 'type' => 2, + 'type' => 2, 'user_id' => $data['user_id'], @@ -229,7 +241,7 @@ class Farmer extends BaseModel $find = $this->dataInfo($dis); - if(empty($find)){ + if (empty($find)) { $dis['status'] = 2; @@ -251,7 +263,7 @@ class Farmer extends BaseModel $user_model = new User(); - $user_model->dataUpdate(['id'=>$data['user_id']],['is_landlord'=>1]); + $user_model->dataUpdate(['id' => $data['user_id']], ['is_landlord' => 1]); } return true; @@ -262,22 +274,23 @@ class Farmer extends BaseModel * @DataTime: 2020-10-21 15:21 * @功能说明:保留两位小数 */ - public function getDistanceAttr($value){ + public function getDistanceAttr($value) + { - if(!empty($value)){ + if (!empty($value)) { - if($value>1000){ + if ($value > 1000) { - $value = $value/1000; + $value = $value / 1000; - $value = round($value,2); + $value = round($value, 2); - $value = $value.'km'; - }else{ + $value = $value . 'km'; + } else { - $value = round($value,2); + $value = round($value, 2); - $value = $value.'m'; + $value = $value . 'm'; } @@ -288,30 +301,29 @@ class Farmer extends BaseModel } - - /** * @author chenniang * @DataTime: 2022-02-28 14:08 * @功能说明:添加商品时农场主下拉框 */ - public function goodsFarmerSelect($user_id){ + public function goodsFarmerSelect($user_id) + { $land_order_model = new LandOrder(); - $dis[] = ['user_id','=',$user_id]; + $dis[] = ['user_id', '=', $user_id]; - $dis[] = ['pay_type','>',1]; + $dis[] = ['pay_type', '>', 1]; //购买土地对农场主id $order_farmer = $land_order_model->where($dis)->column('farmer_id'); - $where[] = ['user_id','=',$user_id]; + $where[] = ['user_id', '=', $user_id]; - $where[] = ['status','in',[2,3]]; + $where[] = ['status', 'in', [2, 3]]; //如果自己是农场主 $farmer = $this->where($where)->column('id'); - $order_farmer = array_merge($order_farmer,$farmer); + $order_farmer = array_merge($order_farmer, $farmer); return $order_farmer; } @@ -322,13 +334,14 @@ class Farmer extends BaseModel * @DataTime: 2022-02-28 16:06 * @功能说明: */ - public function farmerId($uniacid){ + public function farmerId($uniacid) + { $dis = [ 'status' => 2, - 'uniacid'=> $uniacid + 'uniacid' => $uniacid ]; $id = $this->where($dis)->column('id'); @@ -338,7 +351,4 @@ class Farmer extends BaseModel } - - - -} \ No newline at end of file +} diff --git a/app/farm/route/route.php b/app/farm/route/route.php index 1ee5f59..3145720 100644 --- a/app/farm/route/route.php +++ b/app/farm/route/route.php @@ -497,6 +497,8 @@ Route::group('app', function () { Route::get('Index/aboutUsList', 'Index/aboutUsList'); //获取配置信息 Route::get('Index/configInfo', 'Index/configInfo'); + // 农场 + Route::get('Index/indexStoreList', 'Index/indexStoreList'); //文章详情(id) Route::get('Index/articleInfo', 'Index/articleInfo'); //模版列表 diff --git a/app/massage/model/Config.php b/app/massage/model/Config.php index b726504..1277c74 100644 --- a/app/massage/model/Config.php +++ b/app/massage/model/Config.php @@ -1,4 +1,5 @@ insert($data); @@ -25,13 +27,13 @@ class Config extends BaseModel } - /** * @author chenniang * @DataTime: 2020-09-29 11:05 * @功能说明:编辑 */ - public function dataUpdate($dis,$data){ + public function dataUpdate($dis, $data) + { $res = $this->where($dis)->update($data); @@ -45,12 +47,10 @@ class Config extends BaseModel * @DataTime: 2020-09-29 11:06 * @功能说明:列表 */ - public function dataList($dis,$page){ - + public function dataList($dis, $page) + { $data = $this->where($dis)->order('id desc')->paginate($page)->toArray(); - return $data; - } @@ -59,26 +59,16 @@ class Config extends BaseModel * @DataTime: 2020-09-29 11:43 * @功能说明: */ - public function dataInfo($dis){ + public function dataInfo($dis) + { $data = $this->where($dis)->find(); - - if(empty($data)){ - + if (empty($data)) { $this->dataAdd($dis); $data = $this->where($dis)->find(); - } - return !empty($data)?$data->toArray():[]; - + return !empty($data) ? $data->toArray() : []; } - - - - - - - -} \ No newline at end of file +} diff --git a/doc/backend-technical-deep-dive.md b/doc/backend-technical-deep-dive.md new file mode 100644 index 0000000..88a0032 --- /dev/null +++ b/doc/backend-technical-deep-dive.md @@ -0,0 +1,196 @@ +# 后端架构深度解析与开发指南 + +## 1. 引言 + +本文档旨在为开发人员提供一份关于本项目(智慧农场系统)后端架构的深度技术解析。不同于基础的架构介绍,本文档聚焦于**代码实现细节**、**数据库设计范式**以及**核心业务流程**的底层逻辑。它将帮助你在接手项目后,快速理解现有代码模式(Patterns),并安全、高效地扩展新功能。 + +--- + +## 2. 核心架构与技术实现 + +本项目基于 **ThinkPHP 6** 框架开发,采用了典型的 **MVC** 架构,并结合了多应用(Multi-app)模式。 + +### 2.1 C层(Controller)技术实现 + +控制器层主要负责请求接收、参数校验和业务调度。项目在控制器层有以下显著的实现模式: + +#### 2.1.1 基类封装 (`app/ApiRest.php`) +所有 API 控制器均继承自 `app\ApiRest`,该基类提供了以下核心能力: + +- **统一响应格式**:通过 `success($data)` 和 `error($msg)` 方法,强制统一 API 返回结构: + ```json + { + "code": 200, + "data": { ... }, + "sign": "..." // 签名(可选) + } + ``` +- **多租户隔离**:在构造函数中自动解析 `uniacid`(商户/租户ID),并赋值给 `$this->_uniacid`。这是系统支持多商户SaaS模式的核心。 +- **鉴权机制**: + - 检查 HTTP Header 中的 `autograph`(小程序用户标识)。 + - 维护一个 `$noNeedLogin` 白名单。 + - **注意**:`shareChangeData` 方法中硬编码了大量白名单路由,这种实现方式维护成本较高,建议后续改为中间件或注解配置。 + +#### 2.1.2 胖模型,瘦控制器 +控制器(如 `app/farm/controller/IndexLand.php`)通常比较轻量,不包含复杂的计算逻辑。 +- **示例**:在“土地下单”流程中,价格计算、优惠券抵扣等逻辑全部下沉到了 Model 层 (`LandOrder::payOrderInfo`)。 +- **优点**:业务逻辑可复用,控制器代码整洁。 + +### 2.2 M层(Model)技术实现 + +模型层不仅负责数据库交互,还承担了大部分业务逻辑。 + +#### 2.2.1 基类扩展 (`app/BaseModel.php`) +- 实现了基础的 CRUD 方法(`getRow`, `listRow`, `createRow` 等)。 +- **软删除机制**:手动实现了基于 `deleted` 字段和 `delete_time` 的软删除,未使用 TP 自带的 `SoftDelete` Trait。 +- **代码现状**:核心业务 Model(如 `LandOrder`)往往重写了 `dataAdd`/`dataUpdate` 方法,直接调用 TP 的 `insert`/`update`,并未完全依赖 `BaseModel` 的封装。这导致项目中存在两种 CRUD 风格。 + +#### 2.2.2 高级特性应用 +- **获取器 (Getters)**:大量使用 TP 的获取器处理字段格式化。例如 `LandList::getImgsAttr` 将数据库存储的逗号分隔字符串自动转换为数组。 +- **动态追加字段**:使用 `$append` 属性在 JSON 序列化时追加计算字段(如 `min_price`)。 +- **观察者模式**:在 `LandList::updateSome` 中,手动实现了观察者模式 (`app\farm\server\Land`) 来同步更新关联表数据。这是项目中少见的设计模式应用,值得保留和参考。 + +--- + +## 3. 数据库深度解析 + +### 3.1 数据库概览 +- **引擎**:大部分表使用 `MyISAM`。 + - **风险**:MyISAM 不支持事务,且在并发写入时是表级锁。对于涉及资金交易的表(如 `balance_water`, `land_order`),强烈建议迁移到 `InnoDB`。 +- **字符集**:`utf8` / `utf8mb4`。 +- **多租户设计**:几乎所有表都包含 `uniacid` 字段,用于物理隔离不同商户的数据。 + +### 3.2 核心业务实体关系 (ER图) + +以下是“土地认养”核心业务的实体关系推导: + +```mermaid +erDiagram + User ||--o{ LandOrder : "下单" + User ||--o{ Address : "拥有" + Farmer ||--o{ LandList : "管理" + LandList ||--|{ LandSpe : "包含规格" + LandList ||--o{ LandMassif : "包含地块" + LandOrder }|--|| LandList : "关联土地" + LandOrder }|--|| LandSpe : "关联规格" + LandOrder }|--|| LandMassif : "关联地块" + LandOrder ||--|{ LandOrderSeed : "包含种子" + + User { + int id PK + int uniacid + string openid + string nickName + } + + LandList { + int id PK + int farmer_id FK "农场主" + string title "土地名称" + int status + } + + LandOrder { + int id PK + string order_code "订单号" + decimal pay_price "支付金额" + int pay_type "1:未支付 2:已支付" + int status + } +``` + +### 3.3 关键表结构解析 + +#### 1. `ims_lbfarm_land_list` (土地表) +- 核心商品表,存储土地的基本信息。 +- 关联表:`ims_lbfarm_land_spe` (规格), `ims_lbfarm_land_massif` (地块/位置)。 + +#### 2. `ims_lbfarm_land_order` (土地订单表) +- **核心字段**: + - `order_code`: 业务订单号。 + - `transaction_id`: 微信支付流水号。 + - `pay_type`: 支付状态 (1=未支付, 2=微信支付, 3=余额支付)。 + - `seed_data`: 种子信息的 JSON 快照(反范式设计,避免关联查询)。 + +--- + +## 4. 核心业务流程剖析 + +### 4.1 土地认养下单与支付流程 + +这是一个跨越 Controller、Model 和 Service 的复杂流程: + +1. **预下单 (计价)** + - **入口**:`IndexLand::landPayOrderInfo` + - **逻辑**:调用 `LandOrder::payOrderInfo`。 + - **计算公式**:`总价 = 土地规格单价 + (地块单价 * 认养周期) + ∑(种子单价 * 数量) - 优惠券金额`。 + +2. **创建订单** + - **入口**:`IndexLand::landPayOrder` + - **逻辑**:再次调用 `payOrderInfo` 校验价格,然后写入 `land_order` 表,同时写入 `land_order_seed` 表。 + +3. **支付回调 (核心)** + - **逻辑位置**:`LandOrder::orderResult` + - **事务处理**: + 1. 开启事务 (`Db::startTrans()`)。 + 2. 更新订单状态 (`pay_type=2`, `pay_time`)。 + 3. **余额扣除**:如果使用了余额抵扣,调用 `BalanceWater::addWater`。 + 4. **资金流水**:记录 `FinanceWater`。 + 5. **分销结算**:调用 `DistributionCash::addUserCash` 计算分销佣金。 + 6. 提交事务 (`Db::commit()`)。 + - **后续动作**:发送微信订阅消息 (`paySendService`),这是异步或非事务性的操作,放在 commit 之后执行是正确的。 + +--- + +## 5. 开发实战指南 + +### 5.1 如何新增一个 API 接口? + +假设你需要新增一个“获取最近的农场列表”接口: + +1. **创建控制器**: + 在 `app/farm/controller` 下创建 `IndexFarm.php`,继承 `ApiRest`。 + ```php + class IndexFarm extends ApiRest { + public function nearby() { + $lat = $this->_param['lat']; + $lng = $this->_param['lng']; + // 调用 Model 获取数据 + $data = (new Farmer())->getNearby($lat, $lng); + return $this->success($data); + } + } + ``` + +2. **实现 Model 逻辑**: + 在 `app/farm/model/Farmer.php` 中实现 `getNearby` 方法。建议参考 `LandList::indexDataList` 中的距离计算 SQL。 + +3. **配置路由**: + 在 `app/farm/route/route.php` 中注册路由(如果项目未开启自动路由)。目前看项目启用了自动路由,直接访问 `farm/index_farm/nearby` 即可。 + +4. **配置鉴权**: + 如果该接口不需要登录,需要在 `ApiRest::shareChangeData` 或控制器的构造函数中将其加入 `$noNeedLogin` 数组。 + +### 5.2 常见坑与规避 + +1. **数据库事务**: + 由于大量表使用 `MyISAM`,在涉及多表更新时(如订单状态+库存扣减),事务可能不会生效。 + - **建议**:在开发新功能涉及核心交易表时,务必检查表引擎,必要时手动 `ALTER TABLE ... ENGINE=InnoDB`。 + +2. **参数获取**: + 尽量使用 `$this->_param` 获取参数,它合并了 GET 和 POST 数据。避免直接使用 `$_GET` 或 `$_POST`。 + +3. **浮点数计算**: + 项目中存在直接使用浮点数计算金额的情况(如 `round($price, 2)`)。在涉及金额比对时,建议使用 `bccomp` 等高精度函数,避免精度丢失导致的 0.01 元误差。 + +4. **SQL 注入风险**: + 虽然 TP 的 ORM 有防注入机制,但在拼接原生 SQL(如距离计算)时,务必使用参数绑定,严禁直接拼接变量。 + +--- + +## 6. 附录:推荐的重构方向 + +1. **引入 .env 配置**:将 `config/database.php` 中的硬编码配置移至环境变量。 +2. **统一 Model 规范**:废弃 `dataAdd` 等自定义方法,统一使用 TP 标准的 `save/create`,或完善 `BaseModel` 并强制继承。 +3. **中间件鉴权**:将 `ApiRest` 中的硬编码鉴权逻辑重构为 TP 中间件。 +4. **数据库迁移**:编写脚本将所有 `MyISAM` 表迁移至 `InnoDB`。 diff --git a/doc/stsm_farm.sql b/doc/stsm_farm.sql new file mode 100644 index 0000000..dc96ab3 --- /dev/null +++ b/doc/stsm_farm.sql @@ -0,0 +1,2138 @@ +/* + Navicat Premium Dump SQL + + Source Server : 莱米 - 智能农场 + Source Server Type : MySQL + Source Server Version : 50744 (5.7.44-log) + Source Host : 8.134.191.159:3356 + Source Schema : stsm_farm + + Target Server Type : MySQL + Target Server Version : 50744 (5.7.44-log) + File Encoding : 65001 + + Date: 04/01/2026 11:09:45 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for ims_lbfarm_about_us +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_about_us`; +CREATE TABLE `ims_lbfarm_about_us` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(255) DEFAULT '', + `text` text, + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `top` int(11) DEFAULT '0', + `type` int(11) DEFAULT '0' COMMENT '0 普通 1认养 2土地', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_address +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_address`; +CREATE TABLE `ims_lbfarm_address` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_name` varchar(64) CHARACTER SET utf8mb4 DEFAULT '', + `mobile` varchar(32) DEFAULT '', + `province` varchar(64) DEFAULT '', + `city` varchar(64) DEFAULT '', + `area` varchar(64) DEFAULT '', + `status` tinyint(3) DEFAULT '0', + `lng` varchar(64) DEFAULT '0', + `lat` varchar(64) DEFAULT '0', + `address` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `top` int(11) DEFAULT '0', + `create_time` int(11) DEFAULT '0', + `address_info` varchar(625) CHARACTER SET utf8mb4 DEFAULT '', + `user_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_admin_role +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_admin_role`; +CREATE TABLE `ims_lbfarm_admin_role` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `admin_id` int(11) DEFAULT '0', + `role_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_article +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_article`; +CREATE TABLE `ims_lbfarm_article` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT '0', + `user_id` int(11) DEFAULT '0', + `title` varchar(255) DEFAULT '', + `text` longtext, + `create_time` bigint(11) DEFAULT '0', + `top` int(11) DEFAULT '0', + `status` int(11) DEFAULT '1', + `cover` varchar(255) DEFAULT '', + `type` int(11) DEFAULT '1', + `sub_title` varchar(255) DEFAULT '', + `iv` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_attachment +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_attachment`; +CREATE TABLE `ims_lbfarm_attachment` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(10) unsigned NOT NULL, + `uid` int(10) unsigned NOT NULL, + `filename` varchar(255) NOT NULL, + `attachment` varchar(255) NOT NULL, + `type` tinyint(3) unsigned NOT NULL, + `createtime` int(10) unsigned NOT NULL, + `module_upload_dir` varchar(100) DEFAULT NULL, + `group_id` int(11) DEFAULT NULL, + `longbing_attachment_path` char(255) NOT NULL DEFAULT '' COMMENT 'path', + `longbing_driver` char(10) NOT NULL DEFAULT '' COMMENT 'loacl', + `longbing_from` varchar(255) NOT NULL DEFAULT '' COMMENT 'web', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=91 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_attachment_group +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_attachment_group`; +CREATE TABLE `ims_lbfarm_attachment_group` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(25) NOT NULL DEFAULT '', + `uniacid` int(11) DEFAULT NULL, + `uid` int(11) DEFAULT '0', + `type` tinyint(1) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_bag_atv +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_bag_atv`; +CREATE TABLE `ims_lbfarm_bag_atv` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(64) DEFAULT '' COMMENT '标题', + `cover` varchar(125) DEFAULT '' COMMENT '封面图', + `start_time` bigint(11) DEFAULT '0' COMMENT '开始时间', + `end_time` bigint(11) DEFAULT '0' COMMENT '结束时间', + `is_phone` tinyint(3) DEFAULT '0' COMMENT '是否必须授权手机号', + `user_num` int(11) DEFAULT '0' COMMENT '可推荐人数', + `share_cover` varchar(255) DEFAULT '' COMMENT '分享图', + `text` text CHARACTER SET utf8mb4 COMMENT '活动说明', + `have_num` int(11) DEFAULT '0', + `lock` int(11) DEFAULT '0', + `user_coupon` int(11) DEFAULT '0' COMMENT '新人券', + `user_coupon_num` int(11) DEFAULT '0' COMMENT '新人券数量', + `share_coupon` int(11) DEFAULT '0' COMMENT '分享人的券', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_bag_atv_coupon +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_bag_atv_coupon`; +CREATE TABLE `ims_lbfarm_bag_atv_coupon` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `atv_id` int(11) DEFAULT NULL, + `coupon_id` int(11) DEFAULT NULL, + `num` int(11) DEFAULT NULL, + `type` tinyint(3) DEFAULT '1' COMMENT '1新客 2推荐人', + `have_num` int(11) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_bag_atv_record +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_bag_atv_record`; +CREATE TABLE `ims_lbfarm_bag_atv_record` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `atv_id` int(11) DEFAULT '0', + `share_user` int(11) DEFAULT '0' COMMENT '分享人', + `get_user` int(11) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT NULL, + `user_coupon` int(11) DEFAULT '0', + `user_coupon_num` int(11) DEFAULT '0', + `share_coupon` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_bag_atv_record_coupon +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_bag_atv_record_coupon`; +CREATE TABLE `ims_lbfarm_bag_atv_record_coupon` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `type` tinyint(3) DEFAULT '1' COMMENT '1分享者 2获取者', + `coupon_id` int(11) DEFAULT '0', + `atv_id` int(11) DEFAULT '0', + `record_id` int(11) DEFAULT '0', + `num` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_balance_card +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_balance_card`; +CREATE TABLE `ims_lbfarm_balance_card` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(255) DEFAULT '' COMMENT '标题', + `true_price` decimal(10,2) DEFAULT NULL COMMENT '实际价格', + `top` int(11) DEFAULT '0', + `status` int(11) DEFAULT '1', + `create_time` int(11) DEFAULT '0', + `member_level` int(11) DEFAULT '0' COMMENT '绑定的会员等级id', + `cash_type` tinyint(3) DEFAULT '1' COMMENT '1比列,2固定提层', + `cash_balance` decimal(10,2) DEFAULT NULL COMMENT '比列', + `cash` decimal(10,2) DEFAULT NULL COMMENT '抽层', + `integral` decimal(10,2) DEFAULT NULL COMMENT '积分', + `price` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_balance_order_list +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_balance_order_list`; +CREATE TABLE `ims_lbfarm_balance_order_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `order_code` varchar(255) DEFAULT '', + `transaction_id` varchar(255) DEFAULT '', + `pay_price` double(10,2) DEFAULT '0.00', + `sale_price` double(10,2) DEFAULT '0.00', + `true_price` double(10,2) DEFAULT '0.00', + `create_time` bigint(12) DEFAULT '0', + `pay_time` bigint(12) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `title` varchar(255) DEFAULT '', + `card_id` int(11) DEFAULT '0', + `now_balance` double(10,2) DEFAULT '0.00' COMMENT '当前余额', + `member_level` int(11) DEFAULT '0' COMMENT '绑定的会员等级id', + `phone` varchar(32) DEFAULT '0' COMMENT '电话号码', + `have_syn` tinyint(3) DEFAULT '0' COMMENT '是否同步到了银豹', + `error_msg` varchar(255) DEFAULT '', + `integral` decimal(10,2) DEFAULT NULL COMMENT '积分', + `pay_model` tinyint(3) DEFAULT '1' COMMENT '1微信2余额 3支付宝', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_balance_refund_order +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_balance_refund_order`; +CREATE TABLE `ims_lbfarm_balance_refund_order` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `order_code` varchar(255) DEFAULT '', + `transaction_id` varchar(255) DEFAULT '', + `card_id` int(11) DEFAULT '0', + `order_id` int(11) DEFAULT '0', + `apply_price` double(10,2) DEFAULT '0.00', + `refund_price` double(10,2) DEFAULT '0.00', + `title` varchar(255) DEFAULT '', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `sh_time` bigint(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_balance_water +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_balance_water`; +CREATE TABLE `ims_lbfarm_balance_water` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `order_id` int(11) DEFAULT '0', + `type` int(11) DEFAULT '1' COMMENT '1充值,2消费', + `add` tinyint(3) DEFAULT '0', + `price` decimal(10,2) DEFAULT NULL COMMENT '多少钱', + `create_time` bigint(12) DEFAULT '0', + `before_balance` double(10,2) DEFAULT '0.00', + `after_balance` double(10,2) DEFAULT '0.00', + `scene` tinyint(3) DEFAULT '1' COMMENT '0赛车 1商城 2餐饮', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_banner +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_banner`; +CREATE TABLE `ims_lbfarm_banner` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `img` varchar(128) DEFAULT '', + `top` int(11) DEFAULT '1', + `link` varchar(255) DEFAULT '', + `status` tinyint(3) DEFAULT '1', + `type` int(255) DEFAULT '1' COMMENT '1轮播图 2广告图 3认养轮播图', + `connect_type` int(11) DEFAULT '1' COMMENT '1店铺 2文章', + `text_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_banner_text +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_banner_text`; +CREATE TABLE `ims_lbfarm_banner_text` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `banner_id` int(11) DEFAULT '0', + `text_id` int(11) DEFAULT '0', + `type` int(11) DEFAULT '0' COMMENT '1轮播图 2广告图', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_breed +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_breed`; +CREATE TABLE `ims_lbfarm_breed` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `cover` varchar(255) DEFAULT '', + `price` decimal(10,2) DEFAULT NULL, + `top` int(11) DEFAULT '0', + `farmer_id` int(11) DEFAULT '0', + `status` int(11) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `sub_title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '名称', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_breed_order +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_breed_order`; +CREATE TABLE `ims_lbfarm_breed_order` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `order_code` varchar(255) DEFAULT '', + `user_id` int(11) DEFAULT '0', + `claim_order_id` int(11) DEFAULT '0' COMMENT '认养订单id', + `farmer_id` int(11) DEFAULT '0', + `pay_price` decimal(10,2) DEFAULT NULL, + `transaction_id` varchar(64) DEFAULT '', + `create_time` bigint(11) DEFAULT NULL, + `pay_time` bigint(11) DEFAULT '0', + `balance` decimal(10,2) DEFAULT NULL, + `over_time` bigint(11) DEFAULT '0' COMMENT '订单超时退款时间', + `pay_type` tinyint(3) DEFAULT '1', + `text` varchar(625) CHARACTER SET utf8mb4 DEFAULT '', + `int_price` decimal(10,2) DEFAULT NULL COMMENT '原价', + `discount_price` decimal(10,2) DEFAULT NULL COMMENT '抵扣金额', + `coupon_id` int(11) DEFAULT '0' COMMENT '优惠券id', + `get_integral` decimal(10,2) DEFAULT NULL COMMENT '获取积分', + `pay_model` tinyint(3) DEFAULT '1' COMMENT '1微信2余额 3支付宝', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_breed_order_goods +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_breed_order_goods`; +CREATE TABLE `ims_lbfarm_breed_order_goods` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `order_id` int(11) DEFAULT NULL, + `goods_id` int(11) DEFAULT NULL, + `goods_name` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `goods_cover` varchar(255) DEFAULT '', + `goods_num` int(11) DEFAULT '1', + `goods_price` decimal(10,2) DEFAULT NULL, + `true_num` int(11) DEFAULT '0', + `true_price` decimal(10,2) DEFAULT NULL, + `singe_true_price` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_car +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_car`; +CREATE TABLE `ims_lbfarm_car` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `farmer_id` int(11) DEFAULT '0', + `goods_id` int(11) DEFAULT '0', + `spe_id` int(11) DEFAULT '0', + `goods_num` int(11) DEFAULT '1', + `type` int(11) DEFAULT '1' COMMENT '1养殖 5商城', + `status` int(11) DEFAULT '1', + `is_show` int(11) DEFAULT '1', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_claim +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_claim`; +CREATE TABLE `ims_lbfarm_claim` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT '0', + `title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `cate_id` int(11) DEFAULT '0', + `cover` varchar(255) DEFAULT '' COMMENT '封面图', + `desc` varchar(625) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '简介', + `price` decimal(10,2) DEFAULT NULL COMMENT '价格', + `breed` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '品种', + `cycle` int(11) DEFAULT '0' COMMENT '周期', + `output` decimal(10,2) DEFAULT NULL COMMENT '产量', + `harvest_text` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '收货', + `harvest_cover` varchar(255) DEFAULT '', + `address` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '地址', + `lng` varchar(32) DEFAULT '', + `lat` varchar(32) DEFAULT '', + `text` text CHARACTER SET utf8mb4 COMMENT '认养图文详情', + `source_id` int(11) DEFAULT '0' COMMENT '溯源id', + `monitor_id` int(11) DEFAULT '0' COMMENT '监控id', + `status` int(11) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `user_id` int(11) DEFAULT '0', + `farmer_id` int(11) DEFAULT '0', + `send_cycle` varchar(64) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '配送周期', + `send_times` int(11) DEFAULT '0' COMMENT '配送次数', + `sale_num` int(11) DEFAULT '0' COMMENT '销量', + `start_time` bigint(11) DEFAULT '0' COMMENT '认养周期开始时间', + `end_time` bigint(11) DEFAULT '0' COMMENT '认养周期结束时间', + `stock` int(11) DEFAULT '0' COMMENT '库存', + `lock` int(11) DEFAULT '0' COMMENT '乐观锁', + `imgs` text, + `unit` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '单位', + `machine_id` int(11) DEFAULT '0', + `video` varchar(255) DEFAULT '', + `is_self` tinyint(3) DEFAULT '0' COMMENT '是否支持自提', + `is_send` tinyint(3) DEFAULT '0' COMMENT '是否支持配送', + `top` int(11) DEFAULT '0', + `send_tmpl_id` int(11) DEFAULT '0', + `is_fx` tinyint(3) DEFAULT '0' COMMENT '是否开启分销', + `one_fx` decimal(10,2) DEFAULT NULL COMMENT '一级分销', + `two_fx` decimal(10,2) DEFAULT NULL COMMENT '二级分销', + `weight` decimal(10,2) DEFAULT NULL COMMENT '重量', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_claim_order +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_claim_order`; +CREATE TABLE `ims_lbfarm_claim_order` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `order_code` varchar(64) DEFAULT '' COMMENT '订单号', + `user_id` int(11) DEFAULT '0', + `pay_price` decimal(10,2) DEFAULT NULL, + `balance` decimal(10,2) DEFAULT NULL COMMENT '余额支付', + `goods_name` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `goods_cover` varchar(255) DEFAULT '', + `goods_price` decimal(10,2) DEFAULT NULL, + `goods_id` int(11) DEFAULT '0', + `breed` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `cycle` int(11) DEFAULT '0' COMMENT '认养周期', + `harvest_text` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `harvest_cover` varchar(255) DEFAULT '', + `name` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '用户给认养取的名字', + `send_type` tinyint(3) DEFAULT '1' COMMENT '1自提 2快递', + `text` varchar(625) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '备注', + `transaction_id` varchar(64) DEFAULT '', + `create_time` bigint(11) DEFAULT '0', + `pay_time` bigint(11) DEFAULT '0', + `cancel_time` bigint(11) DEFAULT '0', + `claim_id` int(11) DEFAULT '0' COMMENT '认养id', + `farmer_id` int(11) DEFAULT '0' COMMENT '农场主id', + `pay_type` int(11) DEFAULT '1', + `source_id` int(11) DEFAULT '0' COMMENT '溯源id', + `send_cycle` varchar(64) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '配送周期', + `send_times` int(11) DEFAULT '0' COMMENT '配送次数', + `over_time` bigint(11) DEFAULT '0' COMMENT '订单超时退款时间', + `num` int(11) DEFAULT '1', + `unit` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `start_time` bigint(11) DEFAULT NULL COMMENT '认养开始时间', + `end_time` bigint(11) DEFAULT '0' COMMENT '认养结束时间', + `discount_price` decimal(10,2) DEFAULT NULL COMMENT '抵扣金额', + `coupon_id` int(11) DEFAULT '0' COMMENT '优惠券id', + `claim_code` varchar(64) DEFAULT '' COMMENT '认养单号', + `get_integral` decimal(10,2) DEFAULT NULL COMMENT '获取积分', + `pay_model` tinyint(3) DEFAULT '1' COMMENT '1微信2余额 3支付宝', + `init_price` decimal(10,2) DEFAULT NULL, + `out_refund_no` varchar(64) DEFAULT '', + `is_collage` tinyint(3) DEFAULT '0' COMMENT '是否是拼团订单', + `have_notice` tinyint(3) DEFAULT '0' COMMENT '是否发送消息', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_claim_text +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_claim_text`; +CREATE TABLE `ims_lbfarm_claim_text` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `cover` varchar(255) DEFAULT '', + `title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `sub_title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `claim_id` int(11) DEFAULT '0', + `time` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_config +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_config`; +CREATE TABLE `ims_lbfarm_config` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `appid` varchar(32) DEFAULT '', + `appsecret` varchar(64) DEFAULT '', + `app_name` varchar(255) DEFAULT '', + `over_time` int(11) DEFAULT '300' COMMENT '订单超时取消', + `cash_balance` int(11) DEFAULT '100' COMMENT ' 提现比列', + `gzh_appid` varchar(64) DEFAULT '', + `order_tmp_id` varchar(128) DEFAULT '' COMMENT '下单通知', + `cancel_tmp_id` varchar(128) DEFAULT '', + `max_day` int(11) DEFAULT '0' COMMENT '最长预约时间', + `time_unit` int(11) DEFAULT '0' COMMENT '时长单位', + `service_cover_time` int(11) DEFAULT '0' COMMENT '服务倒计时', + `can_tx_time` int(11) DEFAULT '24' COMMENT '多少小时后可提现', + `cash_mini` double(10,2) DEFAULT '0.01', + `mobile` varchar(255) DEFAULT '', + `text` longtext, + `gzh_tplid` varchar(64) DEFAULT '', + `auto_hx_time` int(11) DEFAULT '7', + `app_day` int(11) DEFAULT '0' COMMENT '最长可以预约多少天内', + `start_distance` double(10,2) DEFAULT '0.00' COMMENT '起送距离', + `start_price` decimal(10,2) DEFAULT NULL COMMENT '起送费', + `renew_distance` double(10,2) DEFAULT '0.00' COMMENT '每增加多少km', + `renew_price` decimal(10,2) DEFAULT NULL COMMENT '续费多少元', + `zt_address` varchar(255) DEFAULT '', + `zt_lat` varchar(32) DEFAULT '', + `zt_lng` varchar(32) DEFAULT '', + `map_secret` varchar(255) DEFAULT '4IJBZ-DLACP-3QBDS-LI4FT-U2MZZ-5KFFA', + `ys_appkey` varchar(128) DEFAULT '' COMMENT '萤石云appid', + `ys_secret` varchar(128) DEFAULT '' COMMENT '萤石云密钥', + `app_app_id` varchar(64) DEFAULT '', + `app_app_secret` varchar(64) DEFAULT '', + `web_app_id` varchar(64) DEFAULT '', + `web_app_secret` varchar(64) DEFAULT '', + `app_banner` text, + `login_protocol` text, + `blacklist` tinyint(3) DEFAULT '0' COMMENT '黑名单功能', + `information_protection` longtext COMMENT '个人信息保护', + `app_logo` varchar(255) DEFAULT '', + `app_text` varchar(255) DEFAULT '', + `push_key` varchar(255) DEFAULT '' COMMENT 'app推送key', + `push_secret` varchar(255) DEFAULT '' COMMENT 'app推送secret', + `short_id` varchar(64) DEFAULT '', + `short_secret` varchar(64) DEFAULT '', + `short_sign` varchar(64) DEFAULT '', + `short_code` varchar(64) DEFAULT '', + `ios_login` tinyint(3) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_coupon +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_coupon`; +CREATE TABLE `ims_lbfarm_coupon` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(255) DEFAULT '' COMMENT '名称', + `type` tinyint(3) DEFAULT '0', + `full` double(10,2) DEFAULT NULL COMMENT '满多少', + `discount` double(10,2) DEFAULT NULL COMMENT '减多少', + `rule` text COMMENT '规则', + `text` text COMMENT '详情', + `send_type` tinyint(3) DEFAULT '0' COMMENT '派发方式', + `time_limit` tinyint(3) DEFAULT '0' COMMENT '时间限制', + `start_time` bigint(12) DEFAULT '0', + `end_time` bigint(12) DEFAULT '0', + `day` int(11) DEFAULT '0' COMMENT '有效期', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(12) DEFAULT '0', + `top` int(11) DEFAULT '0', + `stock` int(11) DEFAULT '0' COMMENT '库存', + `have_send` int(11) DEFAULT '0' COMMENT '已发多少张', + `i` int(11) DEFAULT '0', + `is_shop` tinyint(3) DEFAULT '0' COMMENT '支持商城', + `is_land` tinyint(3) DEFAULT '0' COMMENT '支持土地', + `is_claim` tinyint(3) DEFAULT '0' COMMENT '支持认养', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_coupon_record +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_coupon_record`; +CREATE TABLE `ims_lbfarm_coupon_record` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `coupon_id` int(11) DEFAULT '0', + `title` varchar(225) DEFAULT '', + `type` int(11) DEFAULT '0', + `full` double(10,2) DEFAULT '0.00', + `discount` double(10,2) DEFAULT '0.00', + `start_time` bigint(12) DEFAULT '0', + `end_time` bigint(13) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(12) DEFAULT '0', + `num` int(11) DEFAULT '1', + `use_time` bigint(11) DEFAULT '0', + `order_id` int(11) DEFAULT '0', + `pid` int(11) DEFAULT '0', + `rule` text, + `text` text, + `is_show` tinyint(3) DEFAULT '1', + `is_shop` tinyint(3) DEFAULT '0' COMMENT '支持商城', + `is_land` tinyint(3) DEFAULT '0' COMMENT '支持土地', + `is_claim` tinyint(3) DEFAULT '0' COMMENT '支持认养', + `record_id` int(11) DEFAULT '0', + `use_type` tinyint(3) DEFAULT '1' COMMENT '1商城 2土地 3认养', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_evaluate_list +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_evaluate_list`; +CREATE TABLE `ims_lbfarm_evaluate_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `order_id` int(11) DEFAULT '0', + `user_id` int(11) DEFAULT '0', + `star` int(11) DEFAULT '0' COMMENT '酒店评价', + `text` varchar(625) CHARACTER SET utf8mb4 DEFAULT '', + `imgs` text, + `create_time` bigint(11) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `eva_type` int(11) DEFAULT '1' COMMENT '1好评,2中评,3差评', + `type` int(11) DEFAULT '1' COMMENT '1认养2土地', + `farmer_id` int(11) DEFAULT '0', + `order_code` varchar(64) DEFAULT '', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_farmer +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_farmer`; +CREATE TABLE `ims_lbfarm_farmer` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0' COMMENT '用户id', + `title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '基地名称', + `cover` varchar(255) DEFAULT '' COMMENT 'log', + `desc` text CHARACTER SET utf8mb4 COMMENT '农场描述', + `imgs` text COMMENT '轮播图', + `mobile` varchar(32) DEFAULT '' COMMENT '联系电话', + `address` varchar(255) DEFAULT '' COMMENT '地址', + `lng` varchar(32) DEFAULT '0', + `lat` varchar(32) DEFAULT '0', + `user_name` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '姓名', + `phone` varchar(32) DEFAULT '' COMMENT '手机号', + `idcard_code` varchar(64) DEFAULT '' COMMENT '身份证号', + `idcard_imgs` varchar(625) DEFAULT '' COMMENT '身份证正反面', + `status` tinyint(3) DEFAULT '1', + `text` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '审核意见', + `create_time` bigint(11) DEFAULT '0', + `sh_time` bigint(11) DEFAULT '0', + `type` varchar(255) DEFAULT '1' COMMENT '1农场主 2店铺', + `sh_text` varchar(1024) DEFAULT '', + `cash` decimal(10,2) DEFAULT NULL COMMENT '佣金', + `lock` int(11) DEFAULT '0', + `star` decimal(10,1) DEFAULT '5.0', + `iv` int(11) DEFAULT '0', + `business_status` int(11) DEFAULT '0', + `start_time` varchar(32) DEFAULT '', + `end_time` varchar(32) DEFAULT '', + `store_time` bigint(11) DEFAULT '0' COMMENT '开店时间', + `is_admin` tinyint(3) DEFAULT '0' COMMENT '是否是后台创建', + `index_show` tinyint(3) DEFAULT '0' COMMENT '首页展示', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_farmer_finance_water +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_farmer_finance_water`; +CREATE TABLE `ims_lbfarm_farmer_finance_water` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `order_id` int(11) DEFAULT '0', + `order_code` varchar(64) DEFAULT '', + `user_id` int(11) DEFAULT '0', + `farmer_id` int(11) DEFAULT '0', + `price` decimal(10,2) DEFAULT NULL, + `add` tinyint(3) DEFAULT '1', + `type` int(11) DEFAULT '0' COMMENT '1认养 2认养退款 3土地 4土地退款 5养殖 6养殖管理 7提现', + `status` tinyint(11) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `create_date` varchar(32) DEFAULT '', + `cash_status` tinyint(3) DEFAULT '0' COMMENT '-1无法入账 0暂停入账 1待入账 2已经入账', + `cash_time` bigint(10) DEFAULT '0' COMMENT '佣金到账时间', + `role_type` tinyint(3) DEFAULT '1' COMMENT '1 农场主', + `landlord_id` int(11) DEFAULT '0' COMMENT '地主id', + `store_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_farmer_wallet +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_farmer_wallet`; +CREATE TABLE `ims_lbfarm_farmer_wallet` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `farmer_id` int(11) DEFAULT '0', + `pay_price` decimal(10,2) DEFAULT NULL COMMENT '申请提现的金额', + `true_price` decimal(10,2) DEFAULT NULL COMMENT '实际到账金额', + `balance` int(11) DEFAULT '0' COMMENT '提出比列', + `create_time` bigint(11) DEFAULT '0', + `status` int(11) DEFAULT '1', + `is_show` tinyint(3) DEFAULT '1', + `text` varchar(625) CHARACTER SET utf8mb4 DEFAULT '', + `order_code` varchar(64) DEFAULT '', + `type` int(11) DEFAULT '1' COMMENT '1农场主提现', + `online` int(11) DEFAULT '1' COMMENT '1线上打款 2线下', + `sh_time` bigint(11) DEFAULT '0', + `payment_no` varchar(64) DEFAULT '' COMMENT '微信打款单号', + `store_id` int(11) DEFAULT '0' COMMENT '地主id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_land_cate +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_land_cate`; +CREATE TABLE `ims_lbfarm_land_cate` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(255) DEFAULT '', + `top` int(11) DEFAULT '0', + `status` int(11) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `type` int(11) DEFAULT '1' COMMENT '1土地分类 2认养分类', + `is_public` int(11) DEFAULT '0' COMMENT '全选', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_land_cate_text +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_land_cate_text`; +CREATE TABLE `ims_lbfarm_land_cate_text` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `farmer_id` int(11) DEFAULT '0', + `cate_id` int(11) DEFAULT '0', + `type` int(11) DEFAULT '1' COMMENT '1土地分类 认养分类', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_land_cycle +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_land_cycle`; +CREATE TABLE `ims_lbfarm_land_cycle` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `land_id` int(11) DEFAULT '0', + `cycle` int(11) DEFAULT '0' COMMENT '周期', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_land_list +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_land_list`; +CREATE TABLE `ims_lbfarm_land_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '土地名称', + `cate_id` int(11) DEFAULT '0', + `cover` varchar(255) DEFAULT '' COMMENT '封面图', + `desc` text CHARACTER SET utf8mb4, + `address` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '地址', + `lat` varchar(32) DEFAULT '', + `lng` varchar(32) DEFAULT '', + `text` text CHARACTER SET utf8mb4 COMMENT '图文详情', + `send_price` decimal(10,2) DEFAULT NULL COMMENT '配送费', + `status` tinyint(3) DEFAULT '1', + `user_id` int(11) DEFAULT '0', + `create_time` bigint(11) DEFAULT '0', + `farmer_id` int(11) DEFAULT '0', + `sale_num` int(11) DEFAULT '0' COMMENT '销量', + `imgs` text, + `machine_id` int(11) DEFAULT '0' COMMENT '温控仪器id', + `video` varchar(255) DEFAULT '', + `is_fx` tinyint(3) DEFAULT '0' COMMENT '是否开启分销', + `one_fx` decimal(10,2) DEFAULT NULL COMMENT '一级分销', + `two_fx` decimal(10,2) DEFAULT NULL COMMENT '二级分销', + `top` int(11) DEFAULT '0', + `weight` decimal(10,2) DEFAULT NULL COMMENT '重量', + `send_tmpl_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_land_order +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_land_order`; +CREATE TABLE `ims_lbfarm_land_order` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT '0', + `order_code` varchar(64) DEFAULT '', + `user_id` int(11) DEFAULT NULL, + `land_id` int(11) DEFAULT '0' COMMENT '土地id', + `massif_id` int(11) DEFAULT '0' COMMENT '地块服务id', + `pay_price` decimal(10,2) DEFAULT NULL COMMENT '支付价格', + `farmer_id` int(11) DEFAULT '0' COMMENT '农场主', + `spe_id` int(11) DEFAULT '0', + `spe_name` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '规格名称', + `area` double(10,2) DEFAULT '0.00' COMMENT '面积', + `land_price` decimal(10,2) DEFAULT NULL COMMENT '土地价格', + `cycle` int(11) DEFAULT '0' COMMENT '周期', + `text` varchar(625) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '备注', + `pay_type` tinyint(3) DEFAULT '1', + `balance` decimal(10,2) DEFAULT NULL COMMENT '余额', + `massif_title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '土地服务名称', + `massif_price` decimal(10,2) DEFAULT NULL COMMENT '土地服务价格', + `total_massif_price` decimal(10,2) DEFAULT NULL COMMENT '土地服务总价格', + `create_time` bigint(11) DEFAULT '0', + `pay_time` bigint(11) DEFAULT '0', + `transaction_id` varchar(128) DEFAULT '', + `over_time` bigint(11) DEFAULT '0' COMMENT '订单超时退款时间', + `discount_price` decimal(10,2) DEFAULT NULL COMMENT '优惠券抵扣价格', + `coupon_id` int(11) DEFAULT '0' COMMENT '优惠券id', + `rent_user_name` varchar(32) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '租赁人', + `rent_mobile` varchar(32) DEFAULT '' COMMENT '租赁电话', + `goods_name` varchar(64) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '土地', + `goods_cover` varchar(255) DEFAULT '', + `end_time` bigint(11) DEFAULT '0', + `cancel_time` bigint(11) DEFAULT '0', + `land_code` varchar(64) DEFAULT '' COMMENT '土地编号', + `seed_price` decimal(10,2) DEFAULT NULL, + `send_type` int(11) DEFAULT '1', + `have_notice` tinyint(3) DEFAULT '0', + `pay_model` tinyint(3) DEFAULT '1' COMMENT '1微信 2余额 3支付宝', + `get_integral` decimal(10,2) DEFAULT NULL COMMENT '获取积分', + `init_price` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_land_order_seed +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_land_order_seed`; +CREATE TABLE `ims_lbfarm_land_order_seed` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `order_id` int(11) DEFAULT '0', + `title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '种子名称', + `imgs` text COMMENT '封面图', + `output_value` decimal(10,2) DEFAULT NULL COMMENT '产值', + `month` varchar(64) DEFAULT '' COMMENT '月份季节', + `area` decimal(10,2) DEFAULT NULL COMMENT '面积', + `grow_cycle` int(11) DEFAULT '0' COMMENT '生长周期', + `picking_cycle` int(11) DEFAULT '0' COMMENT '采摘周期', + `seed_cycle` int(11) DEFAULT '0' COMMENT '种子周期', + `seed_price` decimal(10,2) DEFAULT NULL COMMENT '种子价格', + `num` int(11) DEFAULT '0', + `total_price` decimal(10,2) DEFAULT NULL, + `seed_id` int(11) DEFAULT '0', + `source_id` int(11) DEFAULT '0' COMMENT '溯源id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_land_source_text +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_land_source_text`; +CREATE TABLE `ims_lbfarm_land_source_text` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `obj_id` int(11) DEFAULT '0', + `source_id` int(11) DEFAULT '0', + `type` int(11) DEFAULT '1' COMMENT '1种子关联', + `title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `cover` varchar(255) DEFAULT '', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_land_spe +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_land_spe`; +CREATE TABLE `ims_lbfarm_land_spe` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `land_id` int(11) DEFAULT '0', + `spe_name` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `area` decimal(10,2) DEFAULT NULL, + `price` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_land_text +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_land_text`; +CREATE TABLE `ims_lbfarm_land_text` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `land_id` int(11) DEFAULT '0', + `obj_id` int(11) DEFAULT '0', + `type` int(11) DEFAULT '1' COMMENT '1 地块服务 2关联种子 3关联溯源 4关联监控 5周期', + `source_id` int(11) DEFAULT '0' COMMENT '关联种子的时候 还需要关联溯源', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_machine +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_machine`; +CREATE TABLE `ims_lbfarm_machine` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `land_id` int(11) DEFAULT '0', + `farmer_id` int(11) DEFAULT '0', + `room_id` int(11) DEFAULT '0', + `title` varchar(64) DEFAULT '', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `type` tinyint(3) DEFAULT '1' COMMENT '1土地绑定 2 认养绑定', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_massif_list +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_massif_list`; +CREATE TABLE `ims_lbfarm_massif_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '地块名称', + `price` decimal(10,2) DEFAULT NULL COMMENT '价格', + `desc` varchar(625) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '简介', + `status` tinyint(3) DEFAULT '1', + `user_id` int(11) DEFAULT '0', + `create_time` bigint(11) DEFAULT '0', + `farmer_id` int(11) DEFAULT '0', + `top` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_massif_service +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_massif_service`; +CREATE TABLE `ims_lbfarm_massif_service` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `cover` varchar(255) DEFAULT '', + `title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `sub_title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `massif_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_monitor +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_monitor`; +CREATE TABLE `ims_lbfarm_monitor` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `farmer_id` int(11) DEFAULT '0', + `deviceSerial` varchar(255) DEFAULT '', + `channelNo` varchar(32) DEFAULT '1', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `title` varchar(255) DEFAULT '', + `cover` varchar(255) DEFAULT '', + `iv` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_monitor_text +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_monitor_text`; +CREATE TABLE `ims_lbfarm_monitor_text` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `obj_id` int(11) DEFAULT '0', + `monitor_id` int(11) DEFAULT '0', + `type` varchar(255) DEFAULT '1' COMMENT '1土地关联 2 认养关联 3 认养订单', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_node +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_node`; +CREATE TABLE `ims_lbfarm_node` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `role_id` int(11) DEFAULT '0' COMMENT '角色id', + `node` varchar(625) DEFAULT '', + `auth` varchar(255) DEFAULT '', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=61 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_oos_config +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_oos_config`; +CREATE TABLE `ims_lbfarm_oos_config` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) NOT NULL DEFAULT '0', + `status` tinyint(4) NOT NULL DEFAULT '1', + `miniapp_name` varchar(50) NOT NULL DEFAULT '', + `open_oss` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0-本地 1-阿里云 2-七牛云 3--腾讯云', + `aliyun_bucket` varchar(255) NOT NULL DEFAULT '' COMMENT '仓库', + `aliyun_access_key_id` varchar(50) NOT NULL DEFAULT '' COMMENT '阿里云', + `aliyun_access_key_secret` varchar(100) NOT NULL DEFAULT '' COMMENT '阿里云', + `aliyun_base_dir` varchar(200) NOT NULL DEFAULT '' COMMENT '图片等资源存储根目录', + `aliyun_zidinyi_yuming` varchar(255) NOT NULL DEFAULT '' COMMENT '自定义域名', + `aliyun_endpoint` varchar(255) NOT NULL DEFAULT '', + `aliyun_rules` text COMMENT '阿里云的规则配置', + `qiniu_accesskey` varchar(100) NOT NULL DEFAULT '' COMMENT '七牛云秘钥', + `qiniu_secretkey` varchar(100) NOT NULL DEFAULT '' COMMENT '七牛云秘钥', + `qiniu_bucket` varchar(50) NOT NULL DEFAULT '' COMMENT '七牛云仓库', + `qiniu_yuming` varchar(255) NOT NULL DEFAULT '' COMMENT '七牛自定义域名 前面要加http://', + `qiniu_rules` text COMMENT '七牛的规则配置', + `tenxunyun_appid` varchar(20) NOT NULL DEFAULT '' COMMENT '腾讯云的appid', + `tenxunyun_secretid` varchar(50) NOT NULL DEFAULT '' COMMENT '腾讯云secretid', + `tenxunyun_secretkey` varchar(50) NOT NULL DEFAULT '' COMMENT '腾讯云的配置', + `tenxunyun_bucket` varchar(50) NOT NULL DEFAULT '' COMMENT '腾讯云图片仓库', + `tenxunyun_region` varchar(50) NOT NULL DEFAULT '' COMMENT '腾讯云地域', + `tenxunyun_yuming` varchar(300) NOT NULL DEFAULT '' COMMENT '腾讯云域名', + `apiclient_cert` varchar(200) NOT NULL DEFAULT '', + `apiclient_key` varchar(200) NOT NULL DEFAULT '' COMMENT '两个证书文件路径', + `create_time` int(11) NOT NULL DEFAULT '0', + `update_time` int(11) NOT NULL DEFAULT '0', + `delete_time` int(11) DEFAULT NULL COMMENT '删除时间', + `deleted` tinyint(1) NOT NULL DEFAULT '0', + `is_sync` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否同步', + `name` varchar(64) NOT NULL DEFAULT '' COMMENT '储蓄名字', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_order_address +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_order_address`; +CREATE TABLE `ims_lbfarm_order_address` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `order_id` int(11) DEFAULT '0', + `user_name` varchar(64) CHARACTER SET utf8mb4 DEFAULT '', + `mobile` varchar(32) DEFAULT '', + `province` varchar(64) DEFAULT '', + `city` varchar(64) DEFAULT '', + `area` varchar(64) DEFAULT '', + `lng` varchar(32) DEFAULT '0', + `lat` varchar(32) DEFAULT '0', + `address` varchar(225) CHARACTER SET utf8mb4 DEFAULT '', + `address_info` varchar(625) CHARACTER SET utf8mb4 DEFAULT '', + `zt_name` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '自提点点名称', + `zt_mobile` varchar(32) DEFAULT '' COMMENT '自提点电话', + `type` tinyint(3) DEFAULT '1' COMMENT '1 租地下单', + `send_type` tinyint(3) DEFAULT '2' COMMENT '1自提 2快递', + `address_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_pay_config +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_pay_config`; +CREATE TABLE `ims_lbfarm_pay_config` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', + `uniacid` int(10) NOT NULL DEFAULT '0' COMMENT '小程序关联id', + `mch_id` varchar(255) NOT NULL DEFAULT '' COMMENT '商户号', + `pay_key` varchar(255) NOT NULL DEFAULT '' COMMENT '支付秘钥', + `cert_path` varchar(255) NOT NULL DEFAULT '' COMMENT '证书', + `key_path` varchar(255) NOT NULL DEFAULT '' COMMENT '证书', + `min_price` int(6) NOT NULL DEFAULT '0' COMMENT '最低提现金额', + `pay_name` varchar(255) NOT NULL DEFAULT 'wechat' COMMENT '支付类型', + `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', + `ali_appid` varchar(64) DEFAULT '' COMMENT '支付宝appid', + `ali_privatekey` text COMMENT '支付宝私钥', + `ali_publickey` text COMMENT '支付宝公钥', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_role +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_role`; +CREATE TABLE `ims_lbfarm_role` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(64) DEFAULT '', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_school_admin +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_school_admin`; +CREATE TABLE `ims_lbfarm_school_admin` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `username` varchar(255) DEFAULT '', + `passwd` varchar(255) DEFAULT '', + `create_time` int(11) DEFAULT '0', + `is_admin` tinyint(3) DEFAULT '1' COMMENT '超级管理员', + `status` tinyint(3) DEFAULT '1', + `o_passwd` varchar(255) DEFAULT '', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_seed +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_seed`; +CREATE TABLE `ims_lbfarm_seed` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '名称', + `imgs` text, + `output_value` decimal(10,2) DEFAULT NULL COMMENT '产值', + `month` int(11) DEFAULT '0' COMMENT '月份季节', + `area` decimal(10,2) DEFAULT NULL COMMENT '面积', + `grow_cycle` decimal(10,1) DEFAULT NULL COMMENT '生长周期', + `picking_cycle` decimal(10,1) DEFAULT NULL COMMENT '采摘周期', + `seed_cycle` decimal(10,1) DEFAULT NULL COMMENT '种子周期', + `seed_price` decimal(10,2) DEFAULT NULL COMMENT '种子价格', + `user_id` int(11) DEFAULT '0', + `status` int(11) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `top` int(11) DEFAULT '0', + `farmer_id` int(11) DEFAULT '0', + `sale_num` int(11) DEFAULT '0' COMMENT '销量', + `send_tmpl_id` int(11) DEFAULT '0' COMMENT '配送模版id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_seed_month +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_seed_month`; +CREATE TABLE `ims_lbfarm_seed_month` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `seed_id` int(11) DEFAULT '0', + `month` int(11) DEFAULT '0', + `season` int(11) DEFAULT '0' COMMENT '季节', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=29 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_send_order +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_send_order`; +CREATE TABLE `ims_lbfarm_send_order` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `order_id` int(11) DEFAULT '0', + `user_id` int(11) DEFAULT '0', + `pay_type` tinyint(3) DEFAULT '1', + `pay_price` decimal(10,2) DEFAULT NULL COMMENT '配送费', + `order_code` varchar(64) DEFAULT '', + `start_time` bigint(11) DEFAULT '0' COMMENT '配送信息', + `end_time` bigint(11) DEFAULT '0' COMMENT '配送时间', + `send_type` tinyint(3) DEFAULT '1' COMMENT '配送方式 1自提 2快递', + `address` varchar(225) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '地址', + `user_name` varchar(64) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '用户名字', + `mobile` varchar(32) DEFAULT '' COMMENT '电话', + `farmer_id` int(11) DEFAULT '0', + `text` varchar(625) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '备注信息', + `create_time` bigint(11) DEFAULT '0', + `transaction_id` varchar(64) DEFAULT '', + `over_time` bigint(11) DEFAULT '0', + `type` tinyint(3) DEFAULT '1' COMMENT '1认养 2土地', + `lat` varchar(32) DEFAULT '', + `distance` double(10,2) DEFAULT '0.00' COMMENT '距离', + `balance` double(10,2) DEFAULT '0.00', + `lng` varchar(32) DEFAULT '', + `pay_time` bigint(11) DEFAULT '0', + `times` int(11) DEFAULT '0', + `refund_time` bigint(11) DEFAULT '0' COMMENT '退款时间', + `refund` tinyint(3) DEFAULT '0', + `refund_code` varchar(255) DEFAULT '' COMMENT '退款单号', + `send_time` bigint(11) DEFAULT '0' COMMENT '发货时间', + `receiving_time` bigint(11) DEFAULT '0' COMMENT '收货时间', + `hx_user` int(11) DEFAULT '0', + `hx_admin` tinyint(3) DEFAULT '0', + `auto_receiving_time` bigint(11) DEFAULT '0' COMMENT '自动收货时间', + `get_integral` decimal(10,2) DEFAULT NULL COMMENT '获取积分', + `pay_model` tinyint(3) DEFAULT '1' COMMENT '1微信2余额 3支付宝', + `goods_num` int(11) DEFAULT '0' COMMENT '配送件数', + `weight` decimal(10,2) DEFAULT NULL COMMENT '重量', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_send_time_config +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_send_time_config`; +CREATE TABLE `ims_lbfarm_send_time_config` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `start_time` varchar(32) DEFAULT '', + `end_time` varchar(32) DEFAULT '', + `status` tinyint(3) DEFAULT '1', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_shop_goods +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_shop_goods`; +CREATE TABLE `ims_lbfarm_shop_goods` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `goods_name` varchar(128) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '商品名字', + `cate_id` int(11) DEFAULT '0' COMMENT '分类id', + `cover` varchar(255) DEFAULT '' COMMENT '封面图', + `imgs` text COMMENT '轮播图', + `text` text COMMENT '商品描述', + `status` tinyint(3) DEFAULT '1', + `top` int(11) DEFAULT '0', + `store` int(11) DEFAULT '0' COMMENT '门店id', + `user_id` int(11) DEFAULT '0' COMMENT '用户id', + `user_type` int(11) DEFAULT '1' COMMENT '1农场主 2地主', + `create_time` int(11) DEFAULT '0', + `sale_num` int(11) unsigned DEFAULT '0' COMMENT '销量', + `lock` int(11) DEFAULT '0' COMMENT '版本号', + `refund_num` int(11) DEFAULT '0' COMMENT '退款数量', + `farmer_id` int(11) DEFAULT '0' COMMENT '农场主id', + `source_id` int(11) DEFAULT '0' COMMENT '溯源id', + `true_sale_num` int(11) DEFAULT '0', + `send_tmpl_id` int(11) DEFAULT '0' COMMENT '运费模版id', + `weight` decimal(10,2) DEFAULT NULL COMMENT '重量', + `desc` varchar(625) DEFAULT '', + `video` varchar(255) DEFAULT '', + `image_url` varchar(255) DEFAULT '', + `is_fx` tinyint(3) DEFAULT '0' COMMENT '是否开启分销', + `one_fx` decimal(10,2) DEFAULT NULL COMMENT '一级分销', + `two_fx` decimal(10,2) DEFAULT NULL COMMENT '二级分销', + `index_show` tinyint(3) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_shop_goods_cate +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_shop_goods_cate`; +CREATE TABLE `ims_lbfarm_shop_goods_cate` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `store_id` int(11) DEFAULT NULL, + `title` varchar(64) DEFAULT '', + `status` tinyint(3) DEFAULT '1', + `top` int(11) DEFAULT '0', + `create_time` bigint(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_shop_goods_sh +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_shop_goods_sh`; +CREATE TABLE `ims_lbfarm_shop_goods_sh` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `cap_id` int(11) DEFAULT '0', + `user_type` int(11) DEFAULT '1' COMMENT '1农场主 2地主', + `create_time` bigint(11) DEFAULT '0', + `order_code` varchar(64) DEFAULT '', + `status` tinyint(3) DEFAULT '1', + `sh_text` varchar(625) DEFAULT '', + `goods_cate` varchar(255) DEFAULT '', + `auto` tinyint(3) DEFAULT '0', + `sh_time` bigint(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_shop_goods_sh_list +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_shop_goods_sh_list`; +CREATE TABLE `ims_lbfarm_shop_goods_sh_list` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `sh_id` int(11) DEFAULT '0' COMMENT '审核id', + `goods_id` int(11) DEFAULT '0', + `goods_name` varchar(255) DEFAULT '' COMMENT '商品列表', + `cate_id` int(11) DEFAULT '0' COMMENT '分类id', + `cover` varchar(255) DEFAULT '' COMMENT '封面图', + `imgs` text COMMENT '轮播图', + `text` text, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_shop_goods_sh_spe +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_shop_goods_sh_spe`; +CREATE TABLE `ims_lbfarm_shop_goods_sh_spe` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `sh_goods_id` int(11) DEFAULT '0', + `title` varchar(225) DEFAULT '', + `stock` int(11) DEFAULT '0', + `price` double(10,2) DEFAULT '0.00', + `spe_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_shop_goods_spe +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_shop_goods_spe`; +CREATE TABLE `ims_lbfarm_shop_goods_spe` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(64) DEFAULT '', + `stock` int(11) unsigned DEFAULT '0', + `price` decimal(10,2) DEFAULT '0.00', + `goods_id` int(11) DEFAULT '0', + `lock` int(11) DEFAULT '0' COMMENT '版本号', + `init_price` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_shop_order +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_shop_order`; +CREATE TABLE `ims_lbfarm_shop_order` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `farmer_id` int(11) DEFAULT '0', + `order_code` varchar(64) DEFAULT '' COMMENT '订单号', + `together` tinyint(3) DEFAULT '1' COMMENT '是否一起支付的', + `top_order_code` varchar(64) DEFAULT '', + `store_id` int(11) DEFAULT '0', + `user_id` int(11) DEFAULT '0' COMMENT '用户id', + `send_type` tinyint(3) DEFAULT '2' COMMENT '1快递 2自提', + `pay_type` tinyint(3) DEFAULT '1' COMMENT '订单状态', + `total_price` decimal(10,2) DEFAULT NULL, + `balance` double(10,2) DEFAULT '0.00' COMMENT '余额支付', + `pay_price` double(10,2) DEFAULT '0.00' COMMENT '支付金额', + `true_price` decimal(10,2) DEFAULT NULL, + `goods_price` double(10,2) DEFAULT '0.00' COMMENT '商品价格', + `init_price` double(10,2) DEFAULT '0.00' COMMENT '原价', + `init_goods_price` decimal(10,2) DEFAULT NULL, + `freight` decimal(10,2) DEFAULT NULL, + `discount` double(10,2) DEFAULT '0.00' COMMENT '折扣', + `distance` decimal(10,2) DEFAULT NULL, + `transaction_id` varchar(64) DEFAULT '', + `text` varchar(625) CHARACTER SET utf8mb4 DEFAULT '', + `hx_user` int(11) DEFAULT '0', + `qr` varchar(255) DEFAULT '', + `mobile` varchar(32) DEFAULT '', + `coupon_id` int(11) DEFAULT '0', + `auto_refund` tinyint(3) DEFAULT '0' COMMENT '自动取消订单', + `have_tx` int(11) DEFAULT '0', + `is_show` tinyint(11) DEFAULT '1', + `create_time` int(11) DEFAULT '0', + `pay_time` int(11) DEFAULT '0', + `end_time` bigint(11) DEFAULT '0' COMMENT '订单取消时间', + `hx_time` bigint(11) DEFAULT '0' COMMENT '核销时间', + `over_time` bigint(11) DEFAULT '0', + `can_refund_time` bigint(11) DEFAULT '0' COMMENT '可申请退款时间', + `hx_over_time` bigint(11) DEFAULT '0', + `send_start_time` bigint(11) DEFAULT '0', + `send_end_time` bigint(11) DEFAULT '0', + `cancel_time` bigint(11) DEFAULT '0' COMMENT '取消时间', + `farmer_show` tinyint(3) DEFAULT '0', + `express_company` varchar(64) DEFAULT '' COMMENT '快递公司', + `express_code` varchar(128) DEFAULT '' COMMENT '快递电话', + `express_mobile` varchar(32) DEFAULT '' COMMENT '快递电话', + `express_user` varchar(32) DEFAULT '' COMMENT '快递员', + `send_time` bigint(11) DEFAULT '0', + `get_integral` decimal(10,2) DEFAULT NULL COMMENT '获取积分', + `integral` decimal(10,2) DEFAULT NULL COMMENT '使用积分', + `integral_discount_price` decimal(10,2) DEFAULT NULL COMMENT '积分抵扣多少钱', + `kill_atv_id` int(11) DEFAULT '0' COMMENT '秒杀活动id', + `pay_model` tinyint(3) DEFAULT '1' COMMENT '1微信2余额 3支付宝', + `kill_discount_price` decimal(10,2) DEFAULT NULL COMMENT '秒杀优惠', + `video` varchar(255) DEFAULT '' COMMENT '视频', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_shop_order_goods +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_shop_order_goods`; +CREATE TABLE `ims_lbfarm_shop_order_goods` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `order_id` int(11) DEFAULT NULL, + `pay_type` int(11) DEFAULT '1' COMMENT '状态', + `goods_name` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '商品名字', + `goods_cover` varchar(255) DEFAULT '' COMMENT '商品封面图', + `spe_name` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '规格名', + `goods_price` decimal(10,2) DEFAULT NULL COMMENT '价格', + `pay_price` decimal(10,2) DEFAULT NULL COMMENT '实际支付价格', + `goods_num` int(11) DEFAULT '0' COMMENT '数量', + `can_refund_num` int(11) DEFAULT NULL COMMENT '可退款数量', + `spe_id` int(11) DEFAULT '0', + `goods_id` int(11) DEFAULT '0', + `user_id` int(11) DEFAULT '0', + `singe_pay_price` decimal(10,2) DEFAULT NULL, + `integral` decimal(10,2) DEFAULT NULL, + `i_price` decimal(10,2) DEFAULT NULL, + `integral_id` int(11) DEFAULT '0', + `kill_atv_id` int(11) DEFAULT '0' COMMENT '秒杀活动id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_shop_refund_order +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_shop_refund_order`; +CREATE TABLE `ims_lbfarm_shop_refund_order` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `order_code` varchar(64) DEFAULT '', + `order_id` int(11) DEFAULT '0', + `user_id` int(11) DEFAULT '0', + `transaction_id` varchar(64) DEFAULT '', + `store_id` int(11) DEFAULT '0' COMMENT '教练', + `pay_price` decimal(10,2) DEFAULT '0.00', + `apply_price` decimal(10,2) DEFAULT '0.00', + `refund_price` decimal(10,2) DEFAULT '0.00', + `status` int(11) DEFAULT '1', + `text` varchar(625) CHARACTER SET utf8mb4 DEFAULT '', + `refund_text` varchar(625) CHARACTER SET utf8mb4 DEFAULT '', + `create_time` bigint(12) DEFAULT '0', + `refund_time` bigint(12) DEFAULT '0', + `balance` decimal(10,2) DEFAULT '0.00', + `cancel_time` bigint(11) DEFAULT '0', + `out_refund_no` varchar(64) DEFAULT '', + `imgs` varchar(1024) DEFAULT '', + `car_price` decimal(10,2) DEFAULT '0.00', + `time_long` int(11) DEFAULT '0' COMMENT '退款服务时长', + `service_price` double(10,2) DEFAULT '0.00', + `total_circle` int(11) DEFAULT '0' COMMENT '总圈数', + `refund_user` int(11) DEFAULT '0', + `refund_user_admin` tinyint(3) DEFAULT '0', + `farmer_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_shop_refund_order_goods +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_shop_refund_order_goods`; +CREATE TABLE `ims_lbfarm_shop_refund_order_goods` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `refund_id` int(11) DEFAULT '0', + `goods_id` int(11) DEFAULT '0', + `goods_name` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `goods_cover` varchar(255) DEFAULT '', + `goods_price` decimal(10,2) DEFAULT NULL, + `goods_num` int(11) DEFAULT '1', + `order_goods_id` int(11) DEFAULT '0', + `order_id` int(11) DEFAULT '0', + `status` int(11) DEFAULT '0', + `spe_name` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `spe_id` int(11) DEFAULT '0', + `kill_atv_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_source +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_source`; +CREATE TABLE `ims_lbfarm_source` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `title` varchar(255) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '名称', + `status` int(11) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `farmer_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_source_text +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_source_text`; +CREATE TABLE `ims_lbfarm_source_text` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `source_id` int(11) DEFAULT '0' COMMENT '溯源id', + `stage` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `cover` varchar(255) DEFAULT '', + `time` bigint(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_tmp_list +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_tmp_list`; +CREATE TABLE `ims_lbfarm_tmp_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `model_name` varchar(255) NOT NULL DEFAULT '0' COMMENT '模块名', + `model_key` varchar(255) NOT NULL DEFAULT '0' COMMENT '模块key', + `tmpl_id` varchar(255) NOT NULL DEFAULT '0' COMMENT '模版id', + `tmpl_name` varchar(255) NOT NULL DEFAULT '0' COMMENT '模版名字', + `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', + `tid` int(11) NOT NULL DEFAULT '0' COMMENT '模版消息的标题id', + `kidList` varchar(255) NOT NULL DEFAULT '0' COMMENT '模版消息的内容', + `sceneDesc` varchar(255) NOT NULL DEFAULT '0' COMMENT '模版消息场景', + `kid` varchar(255) NOT NULL DEFAULT '0' COMMENT '生成模版类容时候需要传的', + `example` varchar(255) NOT NULL DEFAULT '0' COMMENT '样板内容', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_user_list +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_user_list`; +CREATE TABLE `ims_lbfarm_user_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `openid` varchar(64) NOT NULL DEFAULT '', + `nickName` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', + `avatarUrl` varchar(255) DEFAULT '', + `create_time` bigint(11) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `cap_id` int(11) DEFAULT '0', + `city` varchar(255) DEFAULT '', + `country` varchar(255) DEFAULT '', + `gender` int(11) DEFAULT '0', + `language` varchar(32) DEFAULT '', + `province` varchar(128) DEFAULT '', + `balance` double(10,2) DEFAULT '0.00' COMMENT '余额', + `phone` varchar(32) DEFAULT '', + `session_key` varchar(255) DEFAULT '', + `pid` int(11) DEFAULT '0', + `cash` double(10,2) DEFAULT '0.00' COMMENT '分销佣金', + `role` int(11) DEFAULT '0', + `growth` int(11) DEFAULT '0', + `integral` decimal(10,2) DEFAULT NULL, + `vip_time` bigint(11) DEFAULT '0', + `member_level` int(11) DEFAULT '0' COMMENT '会员等级', + `lock` int(11) DEFAULT '0', + `wallet_cash` decimal(10,2) DEFAULT NULL COMMENT '可提现金额(地主收入)', + `is_landlord` tinyint(3) DEFAULT '0' COMMENT '是否是地主', + `landlord_cash` decimal(10,2) DEFAULT NULL COMMENT '地主收入', + `create_date` varchar(32) DEFAULT '', + `year` int(11) DEFAULT '0', + `month` int(11) DEFAULT '0', + `week` int(11) DEFAULT '0', + `last_store_id` int(11) DEFAULT '0' COMMENT '上次访问门店的id', + `app_openid` varchar(64) DEFAULT '' COMMENT 'appopenid', + `wechat_openid` varchar(64) DEFAULT '' COMMENT '小程序openid', + `last_login_type` tinyint(3) DEFAULT '0' COMMENT '0小程序 1app 2web', + `web_openid` varchar(64) DEFAULT '', + `unionid` varchar(64) DEFAULT '', + `is_black` tinyint(3) DEFAULT '0' COMMENT '是否在黑名单', + `fx_code` varchar(32) DEFAULT '' COMMENT '分校码', + `is_fx` tinyint(3) DEFAULT '0' COMMENT '是否是分销员', + `sign_notice` tinyint(3) DEFAULT '0' COMMENT '签到提醒', + `fx_cash` decimal(10,2) DEFAULT NULL COMMENT '分销佣金', + `fx_bind_time` bigint(11) DEFAULT '0' COMMENT '分销绑定时间', + `push_id` varchar(64) DEFAULT '', + `sign_notice_time` bigint(11) DEFAULT '0' COMMENT '签到时间', + `sign_time` bigint(11) DEFAULT '0', + `check` tinyint(3) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `openid` (`openid`,`uniacid`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_claim_collage_join +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_claim_collage_join`; +CREATE TABLE `ims_lbfarm_v2_claim_collage_join` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `atv_id` int(11) DEFAULT '0', + `start_id` int(11) DEFAULT '0', + `price` decimal(10,2) DEFAULT NULL, + `status` tinyint(3) DEFAULT '1', + `num` int(11) DEFAULT '0', + `is_start` tinyint(3) DEFAULT '0', + `create_time` bigint(11) DEFAULT '0', + `claim_id` int(11) DEFAULT '0', + `order_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_claim_collage_list +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_claim_collage_list`; +CREATE TABLE `ims_lbfarm_v2_claim_collage_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `claim_id` int(11) DEFAULT '0' COMMENT '认养id', + `price` decimal(10,2) DEFAULT NULL COMMENT '价格', + `success_num` int(11) DEFAULT '0' COMMENT '成团人数', + `stock` int(11) DEFAULT '0' COMMENT '活动库存', + `start_time` bigint(11) DEFAULT '0', + `end_time` bigint(11) DEFAULT '0', + `success_time` int(11) DEFAULT '0' COMMENT '成团时间 分钟', + `start_times` int(11) DEFAULT NULL COMMENT '发起次数', + `join_times` int(11) DEFAULT '0' COMMENT '参与次数', + `top` int(11) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `title` varchar(255) DEFAULT '', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='认养众筹'; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_claim_collage_start +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_claim_collage_start`; +CREATE TABLE `ims_lbfarm_v2_claim_collage_start` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `atv_id` int(11) DEFAULT '0', + `claim_id` int(11) DEFAULT '0', + `end_time` bigint(11) DEFAULT '0', + `price` decimal(10,2) DEFAULT NULL, + `create_time` bigint(11) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `success_num` int(11) DEFAULT '0', + `order_id` int(11) DEFAULT '0', + `join_times` int(11) DEFAULT '0', + `success_times` bigint(11) DEFAULT '0', + `have_num` int(11) DEFAULT '0' COMMENT '付款人数', + `have_order_num` int(11) DEFAULT '0' COMMENT '下单人数', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_distribution_cash_list +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_distribution_cash_list`; +CREATE TABLE `ims_lbfarm_v2_distribution_cash_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `source_id` int(11) DEFAULT '0', + `cash` decimal(10,2) DEFAULT NULL, + `order_code` varchar(64) DEFAULT '', + `transaction_id` varchar(64) DEFAULT NULL, + `order_id` int(11) DEFAULT '0', + `order_price` decimal(10,2) DEFAULT NULL, + `type` int(11) DEFAULT '1' COMMENT '1商城 2土地 3认养', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `fx_type` tinyint(3) DEFAULT '1' COMMENT '1一级分销 2二级分销', + `reseller_id` int(11) DEFAULT '0' COMMENT '分销商id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='分销佣金'; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_distribution_goods_list +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_distribution_goods_list`; +CREATE TABLE `ims_lbfarm_v2_distribution_goods_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `cash_id` int(11) DEFAULT '0', + `order_goods_id` int(11) DEFAULT '0', + `balance` decimal(10,2) DEFAULT NULL, + `cash` decimal(10,2) DEFAULT NULL, + `num` int(11) DEFAULT '0', + `single_cash` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_distribution_list +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_distribution_list`; +CREATE TABLE `ims_lbfarm_v2_distribution_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `user_name` varchar(32) DEFAULT '', + `mobile` varchar(32) DEFAULT '', + `fx_code` varchar(32) DEFAULT '' COMMENT '邀请码', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `sh_text` varchar(625) DEFAULT '', + `pid` int(11) DEFAULT '0', + `sh_time` bigint(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='分销商'; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_freight_template +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_freight_template`; +CREATE TABLE `ims_lbfarm_v2_freight_template` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(255) DEFAULT '', + `type` tinyint(3) DEFAULT '1' COMMENT '1 按件数 2按重量', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_freight_template_config +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_freight_template_config`; +CREATE TABLE `ims_lbfarm_v2_freight_template_config` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `template_id` int(11) DEFAULT '0', + `start_num` double(10,2) DEFAULT '0.00' COMMENT '首重|首件', + `start_price` decimal(10,2) DEFAULT NULL, + `add_num` double(10,2) DEFAULT NULL COMMENT '续重|续件', + `add_price` decimal(10,2) DEFAULT NULL, + `type` tinyint(3) DEFAULT '1' COMMENT '1按件2按重', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_freight_template_province +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_freight_template_province`; +CREATE TABLE `ims_lbfarm_v2_freight_template_province` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `config_id` int(11) DEFAULT '0', + `province` varchar(128) DEFAULT '', + `template_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=71 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_goods_cate +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_goods_cate`; +CREATE TABLE `ims_lbfarm_v2_goods_cate` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `cate_id` int(11) DEFAULT '0', + `goods_id` int(11) DEFAULT '0', + `type` int(11) DEFAULT '1' COMMENT '1商城 2土地 3认养', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=52 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_goods_store +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_goods_store`; +CREATE TABLE `ims_lbfarm_v2_goods_store` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `store_id` int(11) DEFAULT '0', + `goods_id` int(11) DEFAULT '0', + `type` tinyint(3) DEFAULT '1' COMMENT '1商品 2商品分类 3土地分类 4 认养分类', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=34 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_info_record +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_info_record`; +CREATE TABLE `ims_lbfarm_v2_info_record` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT NULL, + `info_id` int(11) DEFAULT NULL, + `create_time` bigint(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_integral_log +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_integral_log`; +CREATE TABLE `ims_lbfarm_v2_integral_log` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0' COMMENT '用户id', + `controller` int(11) DEFAULT '0' COMMENT '操作者', + `integral_add` decimal(10,2) DEFAULT NULL COMMENT '增减积分', + `integral_before` decimal(10,2) DEFAULT NULL COMMENT '当前积分', + `integral_after` decimal(10,2) DEFAULT NULL, + `create_time` int(11) DEFAULT '0', + `status` int(11) DEFAULT '0', + `order_id` int(11) DEFAULT '0' COMMENT '订单id', + `type` int(11) DEFAULT '0', + `controller_type` int(11) DEFAULT '0', + `update_time` int(11) NOT NULL DEFAULT '0', + `refund` int(11) DEFAULT '0', + `scene` int(11) DEFAULT '1', + `double` int(11) DEFAULT '1' COMMENT '倍数', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_integral_shop +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_integral_shop`; +CREATE TABLE `ims_lbfarm_v2_integral_shop` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `start_time` bigint(11) DEFAULT '0', + `end_time` bigint(11) DEFAULT '0', + `buy_limit` tinyint(3) DEFAULT '1' COMMENT '原价购买 1允许', + `discount_add` tinyint(3) DEFAULT '1' COMMENT '优惠叠加 1允许', + `user_limit` int(11) DEFAULT '1' COMMENT '兑换限制人数', + `type` tinyint(3) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `atv_status` tinyint(3) DEFAULT '1', + `goods_id` int(11) DEFAULT '0', + `create_time` bigint(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_integral_shop_goods +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_integral_shop_goods`; +CREATE TABLE `ims_lbfarm_v2_integral_shop_goods` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `atv_id` int(11) DEFAULT NULL, + `goods_id` int(11) DEFAULT '0' COMMENT '商品id', + `spe_id` int(11) DEFAULT '0' COMMENT '规格id', + `stock` int(11) DEFAULT '0' COMMENT '库存', + `price` decimal(10,2) DEFAULT NULL COMMENT '价格', + `integral` decimal(10,2) DEFAULT NULL, + `have_stock` int(11) DEFAULT '0', + `status` tinyint(11) DEFAULT '1', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_integral_store +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_integral_store`; +CREATE TABLE `ims_lbfarm_v2_integral_store` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `integral_id` int(11) DEFAULT '0', + `store_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_luck_config +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_luck_config`; +CREATE TABLE `ims_lbfarm_v2_luck_config` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(32) DEFAULT '', + `icon` varchar(255) DEFAULT '', + `type` tinyint(3) DEFAULT '1', + `coupon_id` int(11) DEFAULT '0', + `integral` decimal(10,2) DEFAULT NULL, + `num` int(11) DEFAULT '0', + `balance` int(11) DEFAULT '0', + `luck_id` int(11) DEFAULT '0', + `top` int(11) DEFAULT '0', + `status` int(11) DEFAULT '1' COMMENT '1未中奖 2中奖', + `is_luck` int(11) DEFAULT '1' COMMENT '1是奖品 0谢谢惠顾', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_luck_draw +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_luck_draw`; +CREATE TABLE `ims_lbfarm_v2_luck_draw` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(255) DEFAULT '' COMMENT '名称', + `start_time` bigint(11) DEFAULT '0', + `end_time` bigint(11) DEFAULT NULL, + `day_times` int(11) DEFAULT '0' COMMENT '每天可抽奖次数', + `integral` decimal(10,2) DEFAULT NULL COMMENT '每次消耗积分', + `create_time` bigint(11) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `top` int(11) DEFAULT '0', + `cover` varchar(255) DEFAULT '', + `atv_status` tinyint(3) DEFAULT '1', + `text` text, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_luck_record +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_luck_record`; +CREATE TABLE `ims_lbfarm_v2_luck_record` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `atv_id` int(11) DEFAULT '0', + `type` int(11) DEFAULT '1', + `title` varchar(255) DEFAULT '', + `coupon_id` int(11) DEFAULT '0', + `integral` decimal(10,2) DEFAULT NULL, + `use_integral` decimal(10,2) DEFAULT NULL, + `create_time` bigint(11) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `is_luck` tinyint(3) DEFAULT '1', + `icon` varchar(255) DEFAULT '', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_member +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_member`; +CREATE TABLE `ims_lbfarm_v2_member` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(255) DEFAULT '', + `status` tinyint(3) DEFAULT '1', + `top` int(11) DEFAULT '0', + `create_time` bigint(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_seckill_config +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_seckill_config`; +CREATE TABLE `ims_lbfarm_v2_seckill_config` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `atv_id` int(11) DEFAULT '0', + `spe_id` int(11) DEFAULT '0', + `price` decimal(10,2) DEFAULT NULL, + `stock` int(11) DEFAULT '0', + `goods_id` int(11) DEFAULT '0', + `have_stock` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_seckill_goods +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_seckill_goods`; +CREATE TABLE `ims_lbfarm_v2_seckill_goods` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `atv_id` int(11) DEFAULT '0', + `goods_id` int(11) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_seckill_info +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_seckill_info`; +CREATE TABLE `ims_lbfarm_v2_seckill_info` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT '0', + `user_id` int(11) DEFAULT '0', + `kill_id` int(11) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `goods_id` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_seckill_list +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_seckill_list`; +CREATE TABLE `ims_lbfarm_v2_seckill_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `goods_id` int(11) DEFAULT '0', + `title` varchar(255) DEFAULT '', + `start_time` bigint(11) DEFAULT '0', + `end_time` bigint(11) DEFAULT '0', + `is_limit` tinyint(3) DEFAULT '0' COMMENT '是否限购', + `limit_num` int(11) DEFAULT '0' COMMENT '限购件数', + `over_time` int(11) DEFAULT '0', + `top` int(11) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `atv_status` tinyint(3) DEFAULT '1', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_shop_spe +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_shop_spe`; +CREATE TABLE `ims_lbfarm_v2_shop_spe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `goods_id` int(10) NOT NULL, + `title` varchar(101) NOT NULL COMMENT '规格名', + `pid` int(10) NOT NULL DEFAULT '0' COMMENT '0=>顶级规格 其他=>上级规格id', + `uniacid` int(10) NOT NULL, + `status` int(3) NOT NULL DEFAULT '1', + `create_time` int(11) NOT NULL DEFAULT '0', + `update_time` int(11) NOT NULL DEFAULT '0', + `image` varchar(2000) DEFAULT NULL COMMENT '子规格图片地址', + `is_img` tinyint(1) unsigned DEFAULT '0' COMMENT '0.子规格无图 1.子规格有图', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=61 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_shop_spe_price +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_shop_spe_price`; +CREATE TABLE `ims_lbfarm_v2_shop_spe_price` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `goods_id` int(10) NOT NULL, + `spe_id_1` varchar(100) NOT NULL DEFAULT '', + `spe_id_2` varchar(100) NOT NULL DEFAULT '', + `price` decimal(10,2) NOT NULL, + `stock` int(10) NOT NULL DEFAULT '0', + `uniacid` int(10) NOT NULL, + `status` int(3) NOT NULL DEFAULT '1', + `create_time` int(11) NOT NULL DEFAULT '0', + `update_time` int(11) NOT NULL DEFAULT '0', + `original_price` decimal(10,2) NOT NULL COMMENT '原价', + `cost_price` double(10,2) DEFAULT '0.00' COMMENT '成本价', + `lock` int(11) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=53 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_signin +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_signin`; +CREATE TABLE `ims_lbfarm_v2_signin` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `cover` varchar(255) DEFAULT '' COMMENT '背景图', + `integral` decimal(10,2) DEFAULT NULL, + `text` varchar(625) DEFAULT '', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_signin_record +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_signin_record`; +CREATE TABLE `ims_lbfarm_v2_signin_record` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT NULL, + `integral` decimal(10,2) DEFAULT NULL, + `create_time` bigint(11) DEFAULT '0', + `create_date` varchar(32) DEFAULT '', + `status` tinyint(3) DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_system_info +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_system_info`; +CREATE TABLE `ims_lbfarm_v2_system_info` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT '0', + `type` tinyint(3) DEFAULT '1', + `obj_id` int(11) DEFAULT '0', + `msg` varchar(625) DEFAULT '', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `title` varchar(255) DEFAULT '', + `order_code` varchar(64) DEFAULT '', + `goods_cover` varchar(255) DEFAULT '', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=71 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for ims_lbfarm_v2_welfare_column +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_v2_welfare_column`; +CREATE TABLE `ims_lbfarm_v2_welfare_column` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `uniacid` int(11) DEFAULT NULL, + `title` varchar(64) DEFAULT '', + `cover` varchar(255) DEFAULT '', + `top` int(11) DEFAULT '0', + `status` tinyint(3) DEFAULT '1', + `create_time` bigint(11) DEFAULT '0', + `content` text, + `type` tinyint(3) DEFAULT '1' COMMENT '1公益栏目 2系统公告 3运营公告', + `sub_title` varchar(625) DEFAULT '', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='公益栏目'; + +-- ---------------------------- +-- Table structure for ims_lbfarm_wechat_code +-- ---------------------------- +DROP TABLE IF EXISTS `ims_lbfarm_wechat_code`; +CREATE TABLE `ims_lbfarm_wechat_code` ( + `id` char(32) NOT NULL DEFAULT '', + `uniacid` int(11) NOT NULL DEFAULT '0' COMMENT 'uniacid', + `data` text COMMENT '数据', + `create_time` int(11) DEFAULT NULL COMMENT '创建时间', + `update_time` int(11) DEFAULT NULL COMMENT '更新时间', + `delete_time` int(11) DEFAULT NULL COMMENT '删除时间', + `deleted` tinyint(1) DEFAULT '0' COMMENT '1:已回收;0:可用;', + `path` varchar(500) DEFAULT '', + `count` int(11) DEFAULT '0' COMMENT '扫码次数', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/runtime/farm/log/single.log b/runtime/farm/log/single.log deleted file mode 100644 index 52e4516..0000000 --- a/runtime/farm/log/single.log +++ /dev/null @@ -1,3 +0,0 @@ -[2025-12-22T16:47:44+08:00][error] [2006]SQLSTATE[HY000] [2006] MySQL server has gone away -[2025-12-22T16:47:53+08:00][error] [2006]SQLSTATE[HY000] [2006] MySQL server has gone away -[2025-12-22T16:48:07+08:00][error] [2006]SQLSTATE[HY000] [2006] MySQL server has gone away diff --git a/runtime/index/log/1766393312-single.log b/runtime/index/log/1766393312-single.log deleted file mode 100644 index c9eb124..0000000 --- a/runtime/index/log/1766393312-single.log +++ /dev/null @@ -1,54 +0,0 @@ -[2025-12-22T16:47:31+08:00][info] [ VIEW ] /Users/xiaojian/PHP/Smart-Farm/app/index/view/index/index.html [ array ( - 0 => 'jsPath', - 1 => 'jsMin', - 2 => 'jsPdf', - 3 => 'jsWorker', - 4 => 'jsVueMin', - 5 => 'jsVuexMin', - 6 => 'jsMmin', - 7 => 'jsIndexMin', - 8 => 'jsMincss', - 9 => 'jsNcss', - 10 => 'is_founder', - 11 => 'isWe7', - 12 => 'appcss', - 13 => 'manifest', - 14 => 'vendor', - 15 => 'app', -) ] -[2025-12-22T16:47:54+08:00][info] [ VIEW ] /Users/xiaojian/PHP/Smart-Farm/app/index/view/index/index.html [ array ( - 0 => 'jsPath', - 1 => 'jsMin', - 2 => 'jsPdf', - 3 => 'jsWorker', - 4 => 'jsVueMin', - 5 => 'jsVuexMin', - 6 => 'jsMmin', - 7 => 'jsIndexMin', - 8 => 'jsMincss', - 9 => 'jsNcss', - 10 => 'is_founder', - 11 => 'isWe7', - 12 => 'appcss', - 13 => 'manifest', - 14 => 'vendor', - 15 => 'app', -) ] -[2025-12-22T16:47:58+08:00][info] [ VIEW ] /Users/xiaojian/PHP/Smart-Farm/app/index/view/index/index.html [ array ( - 0 => 'jsPath', - 1 => 'jsMin', - 2 => 'jsPdf', - 3 => 'jsWorker', - 4 => 'jsVueMin', - 5 => 'jsVuexMin', - 6 => 'jsMmin', - 7 => 'jsIndexMin', - 8 => 'jsMincss', - 9 => 'jsNcss', - 10 => 'is_founder', - 11 => 'isWe7', - 12 => 'appcss', - 13 => 'manifest', - 14 => 'vendor', - 15 => 'app', -) ] diff --git a/runtime/index/log/single.log b/runtime/index/log/single.log deleted file mode 100644 index a0a1833..0000000 --- a/runtime/index/log/single.log +++ /dev/null @@ -1,18 +0,0 @@ -[2025-12-24T14:08:55+08:00][info] [ VIEW ] /Users/xiaojian/PHP/Smart-Farm/app/index/view/index/index.html [ array ( - 0 => 'jsPath', - 1 => 'jsMin', - 2 => 'jsPdf', - 3 => 'jsWorker', - 4 => 'jsVueMin', - 5 => 'jsVuexMin', - 6 => 'jsMmin', - 7 => 'jsIndexMin', - 8 => 'jsMincss', - 9 => 'jsNcss', - 10 => 'is_founder', - 11 => 'isWe7', - 12 => 'appcss', - 13 => 'manifest', - 14 => 'vendor', - 15 => 'app', -) ] diff --git a/runtime/index/temp/44b4f195aba9980cbd560126153ea29d.php b/runtime/index/temp/44b4f195aba9980cbd560126153ea29d.php deleted file mode 100644 index c57fe69..0000000 --- a/runtime/index/temp/44b4f195aba9980cbd560126153ea29d.php +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - 登录 - 后台管理中心 - - - - - - - - - - - - - - -
- - - - - - - \ No newline at end of file diff --git a/vendor/topthink/framework/src/helper.php b/vendor/topthink/framework/src/helper.php index d1ba047..6e560cb 100644 --- a/vendor/topthink/framework/src/helper.php +++ b/vendor/topthink/framework/src/helper.php @@ -202,6 +202,34 @@ if (!function_exists('dump')) { } } +if (!function_exists('dd')) { + /** + * 浏览器友好的变量输出 + * @param mixed $vars 要输出的变量 + * @return void + */ + function dd(...$vars) + { + ob_start(); + var_dump(...$vars); + + $output = ob_get_clean(); + $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output); + + if (PHP_SAPI == 'cli') { + $output = PHP_EOL . $output . PHP_EOL; + } else { + if (!extension_loaded('xdebug')) { + $output = htmlspecialchars($output, ENT_SUBSTITUTE); + } + $output = '
' . $output . '
'; + } + + echo $output; + die; + } +} + if (!function_exists('env')) { /** * 获取环境变量值 @@ -661,3 +689,29 @@ if (!function_exists('root_path')) { return app()->getRootPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); } } + +if (!function_exists('is_dev')) { + function is_dev() + { + $env = env('APP_ENV', ''); + $env = strtolower($env); + if (in_array($env, ['dev', 'development', 'local', 'test'], true)) { + return true; + } + + return false; + } +} + +if (!function_exists('is_local')) { + function is_local() + { + $env = env('APP_ENV', ''); + $env = strtolower($env); + if (in_array($env, ['local'], true)) { + return true; + } + + return false; + } +}