修改短信验证码签名

This commit is contained in:
tiansf 2025-03-07 11:42:26 +08:00
parent 5a462a31f5
commit c85235c243
5 changed files with 210 additions and 158 deletions

View File

@ -226,38 +226,38 @@ class Base extends Controller{
// dump($file);
die;
// die;
if($file){
$name = $file->getInfo()['name'];
// 使用 pathinfo() 函数获取文件名的扩展名
$pathinfo = pathinfo($name);
$extension = strtolower($pathinfo['extension']); // 转换为小写以进行不区分大小写的比较
$file_name = $pathinfo['filename'];
// 判断扩展名是否不是 .png 或 .gif
if ($extension !== 'png' && $extension !== 'gif') {
// 修改文件名,将扩展名改为 .jpg
$new_filename = date('YmdHis').$file_name . '.jpg';
} else {
$new_filename = date('YmdHis').$name;
}
$info = $file->validate(['size'=>$this->file_size,'ext'=>'jpg,png,gif'])->move(ROOT_PATH . 'public' . DS . 'upload_pic',$new_filename);
if($info){
$insert_data = [
'url_data'=>"https://tc.pcxbc.com/upload_pic/".$new_filename,
'name'=>$new_filename,
'create_time'=>date('Y-m-d H:i:s'),
];
$pic_result = Db::table('admin_pic_manage')->insertGetId($insert_data);
if($pic_result){
return $this->msg(['url'=>$insert_data['url_data'],'id'=>$pic_result]);
}else{
return $this->msg(10002,'图片数据保存失败');
}
}else{
return $this->msg(10002,'图片上传失败');
}
}
// if($file){
// $name = $file->getInfo()['name'];
// // 使用 pathinfo() 函数获取文件名的扩展名
// $pathinfo = pathinfo($name);
// $extension = strtolower($pathinfo['extension']); // 转换为小写以进行不区分大小写的比较
// $file_name = $pathinfo['filename'];
// // 判断扩展名是否不是 .png 或 .gif
// if ($extension !== 'png' && $extension !== 'gif') {
// // 修改文件名,将扩展名改为 .jpg
// $new_filename = date('YmdHis').$file_name . '.jpg';
// } else {
// $new_filename = date('YmdHis').$name;
// }
// $info = $file->validate(['size'=>$this->file_size,'ext'=>'jpg,png,gif'])->move(ROOT_PATH . 'public' . DS . 'upload_pic',$new_filename);
// if($info){
// $insert_data = [
// 'url_data'=>"https://tc.pcxbc.com/upload_pic/".$new_filename,
// 'name'=>$new_filename,
// 'create_time'=>date('Y-m-d H:i:s'),
// ];
// $pic_result = Db::table('admin_pic_manage')->insertGetId($insert_data);
// if($pic_result){
// return $this->msg(['url'=>$insert_data['url_data'],'id'=>$pic_result]);
// }else{
// return $this->msg(10002,'图片数据保存失败');
// }
// }else{
// return $this->msg(10002,'图片上传失败');
// }
// }
}

View File

@ -17,7 +17,7 @@ class Cookbook extends Base{
'cookbook'=>'app_user_cookbook',//菜谱表
'uploadimg'=>'app_user_upload_img',//素材表
'followlist'=>'app_user_follow_list',//关注列表
'collectlist'=>'app_user_collect_list',//收藏列表
'collect_list'=>'app_user_collect_list',//收藏列表
];
// 加 bcadd(,,20)
@ -88,8 +88,8 @@ class Cookbook extends Base{
// return json(['status' => 'error', 'message' => '系统错误']);
// }
}
// 根据菜谱标签查询列表(首页用)
public function find_by_cook_label($data=['token'=>'caadd1be045a65f3','cook_label'=>'早餐','page'=>'1']){
// 根据菜谱标签查询列表(首页用)(OK)
public function find_by_cook_label($data=['token'=>'caadd1be045a65f3','cook_label'=>'家常菜谱','page'=>'1']){
// 尝试捕获异常
// try {
if(count(input('post.')) > 0){
@ -131,7 +131,7 @@ class Cookbook extends Base{
// }
}
// 根据食材详细查找列表
// 根据食材详细查找列表(OK)
public function find_by_food($data=['token'=>'caadd1be045a65f3','food_name'=>'猪肉','page'=>'1']){
// 尝试捕获异常
// try {
@ -423,6 +423,7 @@ class Cookbook extends Base{
$content_num = $cfc->table($this->kitchenscale_db_msg['cookbook'])
->where(['cook_label'=>$cook_label])
->count();
$page_total = ceil($content_num/$page_num);
$content_list = $cfc->table($this->kitchenscale_db_msg['cookbook'])
->alias('cookbook')
@ -432,34 +433,24 @@ class Cookbook extends Base{
->page("$page_now,$page_num")
->select();
// 处理本人是否关注 start
$like_it_arr = [];
// 获取用户收藏列表
$my_collect_list = $cfc->table($this->kitchenscale_db_msg['collect_list'])
->where(['token'=>$data['token']])
->column('cookbook_id');
// dump($my_collect_list);
// 处理菜谱收藏信息
foreach ($content_list as $key => $value) {
array_push($like_it_arr, $value['id']);
}
$like_it_data = $cfc->table($this->kitchenscale_db_msg['collectlist'])
->where("token = '".$data['token']."' AND cookbook_id in (".implode(',',$like_it_arr).") AND is_del = 0")
->select();
$like_it_arr2 = [];
foreach ($like_it_data as $key => $value) {
array_push($like_it_arr2, $value['cookbook_id']);
}
foreach ($content_list as $key => $value) {
if(in_array($value['id'],$like_it_arr2)){
$content_list[$key]['is_like'] = 1;
// if(in_array($value['id'],$my_collect_list)){
if(array_key_exists($value['id'],$my_collect_list)){
$content_list[$key]['is_me_like_it'] = 1;
}else{
$content_list[$key]['is_like'] = 0;
$content_list[$key]['is_me_like_it'] = 0;
}
if($value['cover'] == null){
$content_list[$key]['cover'] = 'https://tc.pcxbc.com/kitchenscale_all/diule.jpg';
}
// 处理本人是否关注 end
for ($i=0; $i < count($content_list); $i++) {
if($content_list[$i]['cover'] == null){
$content_list[$i]['cover'] = 'https://tc.pcxbc.com/kitchenscale_all/diule.jpg';
unset($content_list[$key]['ROW_NUMBER']);
}
}
return $this->msg([
'page_now'=>$page_now,
'page_total'=>$page_total,
@ -482,37 +473,27 @@ class Cookbook extends Base{
->alias('cookbook')
->join($this->kitchenscale_db_msg['uploadimg'].' uploadimg','cookbook.cover = uploadimg.id','LEFT')
->where("cookbook.food_type like '%$food_name%'")
->field('cookbook.id,cookbook.title,uploadimg.pic_url as cover,cookbook.create_user_head_pic,cookbook.create_user_nickname,cookbook.like_it')
->field('cookbook.id,cookbook.title,uploadimg.pic_url as cover,cookbook.create_user_head_pic,cookbook.create_user_nickname,cookbook.like_it as like_num')
->page("$page_now,$page_num")
->select();
// 处理本人是否关注 start
$like_it_arr = [];
// 获取用户收藏列表
$my_collect_list = $cfc->table($this->kitchenscale_db_msg['collect_list'])
->where(['token'=>$data['token']])
->column('cookbook_id');
// dump($my_collect_list);
// 处理菜谱收藏信息
foreach ($content_list as $key => $value) {
array_push($like_it_arr, $value['id']);
}
$like_it_data = $cfc->table($this->kitchenscale_db_msg['collectlist'])
->where("token = '".$data['token']."' AND cookbook_id in (".implode(',',$like_it_arr).") AND is_del = 0")
->select();
$like_it_arr2 = [];
foreach ($like_it_data as $key => $value) {
array_push($like_it_arr2, $value['cookbook_id']);
}
foreach ($content_list as $key => $value) {
if(in_array($value['id'],$like_it_arr2)){
$content_list[$key]['is_like'] = 1;
// if(in_array($value['id'],$my_collect_list)){
if(array_key_exists($value['id'],$my_collect_list)){
$content_list[$key]['is_me_like_it'] = 1;
}else{
$content_list[$key]['is_like'] = 0;
$content_list[$key]['is_me_like_it'] = 0;
}
if($value['cover'] == null){
$content_list[$key]['cover'] = 'https://tc.pcxbc.com/kitchenscale_all/diule.jpg';
}
// 处理本人是否关注 end
for ($i=0; $i < count($content_list); $i++) {
if($content_list[$i]['cover'] == null){
$content_list[$i]['cover'] = 'https://tc.pcxbc.com/kitchenscale_all/diule.jpg';
}
unset($content_list[$key]['ROW_NUMBER']);
}
return $this->msg([
@ -536,6 +517,9 @@ class Cookbook extends Base{
$cookbook_data['step_data'] = json_decode($cookbook_data['step_data'],true);
$cookbook_data_step_data_count = count($cookbook_data['step_data']);
dump($cookbook_data_step_data_count);
dump($cookbook_data);
die;
// 设置需要的图片id
array_push($img_arr, $cookbook_data['cover']);
foreach ($cookbook_data['step_data'] as $key => $value) {
@ -603,7 +587,7 @@ class Cookbook extends Base{
$cookbook_data['follow_status'] = 0;
}
$collect_data = $cfc->table($this->kitchenscale_db_msg['collectlist'])
$collect_data = $cfc->table($this->kitchenscale_db_msg['collect_list'])
->where([
'token'=>$data['token'],
'cookbook_id'=>$data['cookbook_id'],
@ -701,7 +685,7 @@ class Cookbook extends Base{
// 如果查询跟作者一致
return $this->msg(10002,'不能收藏自己');
}
$like_data = $cfc->table($this->kitchenscale_db_msg['collectlist'])
$like_data = $cfc->table($this->kitchenscale_db_msg['collect_list'])
->where([
'token'=>$data['token'],
'cookbook_id'=>$data['cookbook_id'],
@ -720,7 +704,7 @@ class Cookbook extends Base{
// 启动事务
Db::startTrans();
try{
$cfc->table($this->kitchenscale_db_msg['collectlist'])
$cfc->table($this->kitchenscale_db_msg['collect_list'])
->where([
'token'=>$data['token'],
'cookbook_id'=>$data['cookbook_id'],
@ -743,7 +727,7 @@ class Cookbook extends Base{
// 启动事务
Db::startTrans();
try{
$cfc->table($this->kitchenscale_db_msg['collectlist'])
$cfc->table($this->kitchenscale_db_msg['collect_list'])
->insert([
'token'=>$data['token'],
'cookbook_id'=>$data['cookbook_id'],

View File

@ -13,16 +13,14 @@ class Index extends Base{
'zhanghao'=>'app_account_number',//账号表
'juese'=>'app_user_data',//角色表
'banner'=>'admin_notice_banner',//banner
'read_log'=>'admin_editor_text_like_up_log',//阅读记录
'cookbook'=>'app_user_cookbook',//菜谱表
'upload_img'=>'app_user_upload_img',//素材表
];
protected $kitchenscale_db_msg = [
'cookbook'=>'app_user_cookbook',//菜谱表
'uploadimg'=>'app_user_upload_img',//素材表
'foodlist1'=>'app_food_type_one',//素材表
'foodlist2'=>'app_food_type_two',//素材表
'foodlist3'=>'app_food_type_three',//素材表
'uploadimg'=>'app_user_upload_img',//图片素材表
'foodlist1'=>'app_food_type_one',//食材列表1
'foodlist2'=>'app_food_type_two',//食材列表2
'foodlist3'=>'app_food_type_three',//食材列表3
'collect_list'=>'app_user_collect_list',//素材表
];
@ -34,12 +32,19 @@ class Index extends Base{
################################################################接口################################################################
################################################################接口################################################################
// 获取默认配置信息(包含:食材的分类列表)
public function get_default_config(){
// 获取默认配置信息(包含:食材的分类列表,用户角色信息)(OK)
public function get_default_config($data = ['token'=>'caadd1be045a65f30b92aa805f1de54a']){
// try {
$return_data = $this->get_default_config_action();
// 成功
// $this->record_api_log($data, null, $return_data);
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_default_config_action($data);
return $return_data;
// } catch (\Exception $e) {
// // 捕获异常
@ -47,6 +52,7 @@ class Index extends Base{
// $logContent["line"] = $e->getLine();
// $logContent['all_content'] = "异常信息:\n";
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
// $logContent['all_content'] .= "接口: get_default_config\n";
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
@ -54,12 +60,11 @@ class Index extends Base{
// $this->record_api_log($data, $logContent, null);
// return $this->msg(99999);
// }
}
// 获取首页信息
// 获取首页信息banner金刚区label_list(OK)
public function get_homepage_information($data = ['token'=>'caadd1be045a65f30b92aa805f1de54a']){
// try {
try {
// 你的业务逻辑
if(count(input('post.')) > 0){
$data = input('post.');
@ -74,26 +79,64 @@ class Index extends Base{
// 成功
$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);
// }
} catch (\Exception $e) {
// 捕获异常
$logContent["flie"] = $e->getFile();
$logContent["line"] = $e->getLine();
$logContent['all_content'] = "异常信息:\n";
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
$logContent['all_content'] .= "接口: (get_homepage_information)\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);
}
}
// 首页搜索接口(OK)
public function search_column($data = ['search_data'=>'鱼','token'=>'caadd1be045a65f30b92aa805f1de54a']){
try {
// 你的业务逻辑
if(count(input('post.')) > 0){
$data = input('post.');
}
if(!array_key_exists('search_data', $data) || !array_key_exists('token', $data)){
return $this->msg(10001);
}
if(!$this->verify_data_is_ok($data['search_data'],'str')){
return $this->msg(10005);
}
if(!$this->verify_data_is_ok($data['token'],'str')){
return $this->msg(10005);
}
$return_data = $this->search_column_action($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'] .= "接口: (search_column)\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#######################################################################
#######################################################################action#######################################################################
#######################################################################action#######################################################################
public function get_default_config_action(){
public function get_default_config_action($data){
$return_data = [
'food_list'=>[],
'account'=>[],
];
$cfc = Db::connect('cfc_db');
// 获取食材分类列表start
@ -122,30 +165,32 @@ class Index extends Base{
}
$return_data['food_list'] = $foodlist1;
// 获取食材分类列表end
// 获取账号下信息以及用户信息start
$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.grade,juese.head_pic')
->select();
$return_data['account'] = $user_account;
// 获取账号下信息以及用户信息end
return $this->msg($return_data);
}
public function get_homepage_information_action($data){
$return_data = [
'account'=>[],
'banner'=>[],
'content'=>[
'label_list'=>[],
'content_list'=>[],
'jingang_region'=>[
['name'=>'菜谱分类','jump_url'=>'/xxx/xxx/xxx','icon'=>'/xxx/xxx/xxx'],
['name'=>'我的收藏','jump_url'=>'/xxx/xxx/xxx','icon'=>'/xxx/xxx/xxx'],
['name'=>'热量计算','jump_url'=>'/xxx/xxx/xxx','icon'=>'/xxx/xxx/xxx'],
['name'=>'健康食谱','jump_url'=>'/xxx/xxx/xxx','icon'=>'/xxx/xxx/xxx'],
],
'label_list'=>[],
];
$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')
->field('juese.id as aud_id,juese.nickname,juese.birthday,juese.gender,juese.grade,juese.head_pic')
->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)")
@ -178,32 +223,52 @@ class Index extends Base{
}
$return_data['banner'] = $banner_list;
// 获取菜谱列表
$label_list = $cfc->table($this->kitchenscale_db_msg['cookbook'])->group('cook_label')->field('cook_label,count(*) as num')->select();
// dump($label_list);
if(count($label_list) <= 0){
$return_data['content']['label_list'] = [];
$return_data['content']['content_list'] = [];
$return_data['label_list'] = [];
return $this->msg($return_data);
}
$return_data['label_list'] = $label_list;
return $this->msg($return_data);
}
public function search_column_action($data){
$cookbook = new Cookbook();
$cfc = Db::connect('cfc_db');
// 获取菜谱信息
$content_list = $cfc->table($this->kitchenscale_db_msg['cookbook'])
->alias('zhanghao')
->join($this->kitchenscale_db_msg['uploadimg'].' uploadimg','zhanghao.cover = uploadimg.id','LEFT')
->where(['zhanghao.cook_label'=>$label_list[0]['cook_label']])
->field('zhanghao.title,uploadimg.pic_url as cover,zhanghao.create_user_head_pic,zhanghao.create_user_nickname,zhanghao.like_it')
->page("1,20")
->alias('cookbook')
->join($this->kitchenscale_db_msg['uploadimg'].' uploadimg','cookbook.cover = uploadimg.id','LEFT')
->where("cookbook.title LIKE '%".$data['search_data']."%' OR cookbook.describe_data LIKE '%".$data['search_data']."%'")
->field("cookbook.id,cookbook.title,cookbook.create_user_head_pic,cookbook.create_user_nickname,cookbook.like_it as like_num,uploadimg.pic_url as cover")
->select();
$return_data['content']['label_list'] = $label_list;
for ($i=0; $i < count($content_list); $i++) {
if($content_list[$i]['cover'] == null){
$content_list[$i]['cover'] = 'https://tc.pcxbc.com/kitchenscale_all/diule.jpg';
if(count($content_list)<=0){
return $this->msg([]);
}
// 获取用户收藏列表
$my_collect_list = $cfc->table($this->kitchenscale_db_msg['collect_list'])
->where(['token'=>$data['token']])
->column('cookbook_id');
// dump();
// 处理菜谱收藏信息
foreach ($content_list as $key => $value) {
if(array_key_exists($value['id'],$my_collect_list)){
$content_list[$key]['is_me_like_it'] = 1;
}else{
$content_list[$key]['is_me_like_it'] = 0;
}
if($value['cover'] == null){
$content_list[$key]['cover'] = 'https://tc.pcxbc.com/kitchenscale_all/diule.jpg';
}
unset($content_list[$key]['ROW_NUMBER']);
}
$return_data['content']['content_list'] = $content_list;
return $this->msg($return_data);
return $this->msg($content_list);
}
}

View File

@ -387,7 +387,7 @@ class Login extends Base{
$postData = array(
'phone' => $tel,
// 'content' => '您好欢迎使用Reedaw,您的手机验证码是:'.$code.',验证码三分钟内有效,若非本人操作,请忽略!'
'content' => '【Reedaw】您好欢迎使用Reedaw您的验证码是'.$code.',验证码一分钟内有效,若非本人操作,请忽略本短信'
'content' => '【瑞达沃】您好欢迎使用Reedaw您的验证码是'.$code.',验证码一分钟内有效,若非本人操作,请忽略本短信'
);
$postData = json_encode($postData);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
@ -403,7 +403,6 @@ class Login extends Base{
// 关闭cURL会话
curl_close($ch);
// 处理响应
if ($response) {
return json_decode($response,true);
} else {

View File

@ -418,11 +418,15 @@ Route::any('/testedition/kitchenscale/pic_upload_action', 'app/kitchenscale/test
// 首页内容################################################################
// 获取配置类信息
Route::any('/kitchenscale/get_default_config', 'app/kitchenscale/app.index/get_default_config');
Route::any('/kitchenscale/get_default_config', 'app/Kitchenscale/app.Index/get_default_config');
Route::any('/testedition/kitchenscale/get_default_config', 'app/kitchenscale/testapp.index/get_default_config');
// 获取首页页面展示数据
Route::any('/kitchenscale/get_homepage_information', 'app/kitchenscale/app.index/get_homepage_information');
Route::any('/testedition/kitchenscale/get_homepage_information', 'app/kitchenscale/testapp.index/get_homepage_information');
// 首页搜索接口
Route::any('/kitchenscale/search_column', 'app/kitchenscale/app.index/search_column');
Route::any('/testedition/kitchenscale/search_column', 'app/kitchenscale/testapp.index/search_column');
// 菜谱内容################################################################
// 添加菜谱