diff --git a/application/KitchenScale/controller/app/Index.php b/application/KitchenScale/controller/app/Index.php new file mode 100644 index 0000000..ebad67d --- /dev/null +++ b/application/KitchenScale/controller/app/Index.php @@ -0,0 +1,153 @@ +'test_app_account_number',//账号表 + 'juese'=>'test_app_user_data',//角色表 + 'banner'=>'admin_notice_banner',//角色表 + 'read_log'=>'admin_editor_text_like_up_log',//角色表 + + + ]; + + + // 加 bcadd(,,20) + // 减 bcsub(,,20) + // 乘 bcmul(,,20) + // 除 bcdiv(,,20) + ################################################################接口################################################################ + ################################################################接口################################################################ + ################################################################接口################################################################ + + // 获取默认配置信息 + public function get_default_config(){ + // try { + $return_data = $this->get_default_config_action($data); + // 成功 + $this->record_api_log($data, null, $return_data); + return $return_data; + // } catch (\Exception $e) { + // // 捕获异常 + // $logContent["flie"] = $e->getFile(); + // $logContent["line"] = $e->getLine(); + // $logContent['all_content'] = "异常信息:\n"; + // $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n"; + // $logContent['all_content'] .= "代码: " . $e->getCode() . "\n"; + // $logContent['all_content'] .= "文件: " . $e->getFile() . "\n"; + // $logContent['all_content'] .= "行号: " . $e->getLine() . "\n"; + // $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n"; + // $this->record_api_log($data, $logContent, null); + // return $this->msg(99999); + // } + + } + + // 获取首页信息 + public function get_homepage_information($data = ['token'=>'6441bf7dabea7b3360a30240d3b19fc5']){ + // try { + // 你的业务逻辑 + if(count(input('post.')) > 0){ + $data = input('post.'); + } + if(!array_key_exists('token', $data)){ + return $this->msg(10001); + } + if(!$this->verify_data_is_ok($data['token'],'str')){ + return $this->msg(10005); + } + $return_data = $this->get_homepage_information_action($data); + // 成功 + $this->record_api_log($data, null, $return_data); + return $return_data; + // } catch (\Exception $e) { + // // 捕获异常 + // $logContent["flie"] = $e->getFile(); + // $logContent["line"] = $e->getLine(); + // $logContent['all_content'] = "异常信息:\n"; + // $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n"; + // $logContent['all_content'] .= "代码: " . $e->getCode() . "\n"; + // $logContent['all_content'] .= "文件: " . $e->getFile() . "\n"; + // $logContent['all_content'] .= "行号: " . $e->getLine() . "\n"; + // $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n"; + // $this->record_api_log($data, $logContent, null); + // return $this->msg(99999); + // } + } + #######################################################################action####################################################################### + + public function get_default_config_action(){ + + } + + public function get_homepage_information_action($data){ + + $return_data = [ + 'account'=>[], + 'banner'=>[], + 'content'=>[], + ]; + + $cfc = Db::connect('cfc_db'); + // 获取账号下信息以及用户信息 + $user_account = Db::table($this->reedaw_db_msg['zhanghao']) + ->alias('zhanghao') + ->join($this->reedaw_db_msg['juese'].' juese','zhanghao.id = juese.aan_id','LEFT') + ->where(["zhanghao.token"=>$data['token'],'juese.is_del'=>0]) + ->field('juese.id as aud_id,juese.nickname,juese.birthday,juese.gender,juese.last_update_time,juese.grade,juese.head_pic,juese.weight,juese.height,juese.identity_name,juese.address,juese.identity_id,juese.weight') + ->select(); + $return_data['account'] = $user_account; + + // 获取banner + $banner_list = Db::table($this->reedaw_db_msg['banner']) + ->where("is_del = 0 AND scene_data IN (21)") + ->order('sort_num desc,id desc') + ->field('id,title,pic,type,jump_url,create_time,scene_data,sort_num,parameter_data') + ->select(); + foreach ($banner_list as $key => $value) { + if($value['type'] == '1'){ + $banner_list[$key]['type'] = 'h5'; + $banner_list[$key]['id'] = $value['parameter_data']; + }else{ + $banner_list[$key]['type'] = 'wechat'; + // 提取查询字符串部分(?后面的部分) + $queryString = substr($banner_list[$key]['jump_url'], strpos($banner_list[$key]['jump_url'], '?') + 1); + // 使用parse_str解析查询字符串 + $params = []; + parse_str($queryString, $params); + // 提取appid和path的值 + $appid = isset($params['appid']) ? $params['appid'] : null; + $path = isset($params['path']) ? $params['path'] : null; + $banner_list[$key]['appid'] = $appid; + $banner_list[$key]['path'] = $path; + // 重新定义跳转链接为中间页 + $banner_list[$key]['jump_url'] = "https://tc.pcxbc.com/open_wechat_content"; + } + unset($banner_list[$key]['scene_data']); + unset($banner_list[$key]['sort_num']); + unset($banner_list[$key]['ROW_NUMBER']); + unset($banner_list[$key]['parameter_data']); + } + $return_data['banner'] = $banner_list; + + // 获取菜谱列表 + + dump($return_data); + die; + + if($user){ + return $this->msg(['token'=>$user['token']]); + }else{ + return $this->msg(10004); + } + + } + +} \ No newline at end of file diff --git a/application/KitchenScale/controller/app/Login.php b/application/KitchenScale/controller/app/Login.php index 604d23e..4aff619 100644 --- a/application/KitchenScale/controller/app/Login.php +++ b/application/KitchenScale/controller/app/Login.php @@ -5,6 +5,13 @@ namespace app\KitchenScale\controller\app; use think\Db; class Login extends Base{ + + protected $code_time = 50; + // protected $token_time = 2592000;//30天的秒数 + protected $default_head_pic = 'http://tc.pcxbc.com/tsf/head_pic.png'; + protected $login_use_db_name = [ + '1'=>'app_account_number', + ]; // 加 bcadd(,,20) // 减 bcsub(,,20) @@ -14,33 +21,8 @@ class Login extends Base{ ################################################################接口################################################################ ################################################################接口################################################################ - public function register_api($data = ['account'=>123,'password'=>456]){ - try { - // 你的业务逻辑 - if(count(input('post.')) > 0){ - $data = input('post.'); - } - if(!array_key_exists('account', $data) && !array_key_exists('password', $data)){ - return $this->msg(10001); - } - $return_data = $this->login_action($data); - // 成功 - $this->record_api_log($data, null, $return_data); - return $return_data; - } catch (\Exception $e) { - // 捕获异常 - $logContent["flie"] = $e->getFile(); - $logContent["line"] = $e->getLine(); - $logContent['all_content'] = "异常信息:\n"; - $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n"; - $logContent['all_content'] .= "代码: " . $e->getCode() . "\n"; - $logContent['all_content'] .= "文件: " . $e->getFile() . "\n"; - $logContent['all_content'] .= "行号: " . $e->getLine() . "\n"; - $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n"; - $this->record_api_log($data, $logContent, null); - return $this->msg(99999); - } - } + // 注册 + public function login_api($data = ['account'=>123,'password'=>456]){ try { // 你的业务逻辑 diff --git a/application/app/controller/Msginformation.php b/application/app/controller/Msginformation.php index ffa7730..fdf1014 100644 --- a/application/app/controller/Msginformation.php +++ b/application/app/controller/Msginformation.php @@ -427,8 +427,8 @@ class Msginformation extends Base{ 'banner'=>[] ]; // return $this->msg($return_data); - // 所有可用记录 - $all_data = Db::table($this->msginformation_use_db_name['3'])->where(['is_del'=>0])->select(); + // 所有可用记录. + $all_data = Db::table($this->msginformation_use_db_name['3'])->where("is_del = 0 AND scene_data IN (1,2,3)")->select(); // 用户阅读记录 $user_read_log = Db::table($this->msginformation_use_db_name['2'])->where(['token'=>$data['token']])->field('aetc_id')->select(); $user_read_data = []; diff --git a/application/config.php b/application/config.php index 25d573c..64121e7 100644 --- a/application/config.php +++ b/application/config.php @@ -240,4 +240,29 @@ return [ 'var_page' => 'page', 'list_rows' => 15, ], + + + // 第二个数据库配置(厨房秤) + 'cfc_db' => [ + // 数据库类型 + 'type' => 'sqlsrv', + // 服务器地址 + 'hostname' => '121.36.67.254', + // 数据库名 + 'database' => 'kitchen_scale', + // 用户名 + 'username' => 'jt_user', + // 密码 + 'password' => 'jtuser1qaz@WSX', + // 端口 + 'hostport' => '4331', + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => 'utf8', + // 数据库表前缀 + 'prefix' => '', + // 数据库调试模式 + 'debug' => true, + ], ]; diff --git a/application/database.php b/application/database.php index ae27ae4..f6da442 100644 --- a/application/database.php +++ b/application/database.php @@ -53,4 +53,6 @@ return [ 'datetime_format' => 'Y-m-d H:i:s', // 是否需要进行SQL性能分析 'sql_explain' => false, + // 更多的数据库连接配置(例如:第二个数据库) + ]; diff --git a/application/route.php b/application/route.php index 53121e1..3339923 100644 --- a/application/route.php +++ b/application/route.php @@ -40,8 +40,6 @@ Route::any('/bluetooth_code', 'code/qrcode/bluetooth_code'); Route::any('/device_api_1', 'admin/device/device_request_api'); // Route::any('/CityList.js', 'tsf/CityList.js'); - - Route::any('/see_device_msg', 'admin/device/see_device_msg'); @@ -391,7 +389,16 @@ Route::any('/open_wechat_content', 'app/Msginformation/open_wechat_content'); +########################################################################################################################################### +################################################################以上是Reedaw################################################################ +################################################################下面是厨房秤################################################################ +########################################################################################################################################### + + +Route::any('/get_homepage_information', 'app/KitchenScale/app.index/get_homepage_information'); + +Route::any('/testedition/get_homepage_information', 'testapp/KitchenScale/app.get_homepage_information');