250802
This commit is contained in:
parent
6b7b07fd8c
commit
c3b233b946
|
|
@ -27,6 +27,7 @@ class Base extends Controller{
|
||||||
'20001'=>'登录失效',
|
'20001'=>'登录失效',
|
||||||
'99999'=>'网络异常,请稍后重试',
|
'99999'=>'网络异常,请稍后重试',
|
||||||
];
|
];
|
||||||
|
protected $file_max = 1024*1024*2;//xxxMB
|
||||||
// 加 bcadd(,,20)
|
// 加 bcadd(,,20)
|
||||||
// 减 bcsub(,,20)
|
// 减 bcsub(,,20)
|
||||||
// 乘 bcmul(,,20)
|
// 乘 bcmul(,,20)
|
||||||
|
|
@ -34,74 +35,7 @@ class Base extends Controller{
|
||||||
################################################################接口################################################################
|
################################################################接口################################################################
|
||||||
################################################################接口################################################################
|
################################################################接口################################################################
|
||||||
################################################################接口################################################################
|
################################################################接口################################################################
|
||||||
// 接口记录
|
|
||||||
public function record_api_log($params, $error = null, $response = null){
|
|
||||||
$logContent = "接口请求参数:" . json_encode($params, JSON_UNESCAPED_UNICODE) . PHP_EOL;
|
|
||||||
if ($error) {
|
|
||||||
$logContent .= "错误信息:" . $error['all_content'] . PHP_EOL;
|
|
||||||
if(!cache($error['flie']."_".$error['line'])){
|
|
||||||
cache($error['flie']."_".$error['line'],"API错误",3600);
|
|
||||||
$this->send_email_api_error(["tsf3920322@126.com"],['title'=>'接口报错','from_user_name'=>'厨房秤(后台)','content'=>$logContent]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($response) {
|
|
||||||
$logContent .= "返回信息:" . json_encode($response, JSON_UNESCAPED_UNICODE) . PHP_EOL;
|
|
||||||
}
|
|
||||||
// 使用ThinkPHP的日志记录方法
|
|
||||||
Log::record($logContent, 'api_log');
|
|
||||||
|
|
||||||
}
|
|
||||||
/* 接口说明(发邮件)
|
|
||||||
* $address(收件人的邮箱地址) 数组 格式: ['460834639@qq.com','460834639@qq.com'.......]
|
|
||||||
* $content(邮件的主题数据信息) 数组 格式:['title'=>'123','from_user_name'=>'123','content'=>'123']
|
|
||||||
* $annex(附件路径信息) 字符串
|
|
||||||
*/
|
|
||||||
public function send_email_api_error($address,$content,$annex=''){
|
|
||||||
// $ad = '460834639@qq.com';
|
|
||||||
$ad1 = '295155911@qq.com';
|
|
||||||
$mail = new PHPMailer(); //实例化
|
|
||||||
$mail->IsSMTP(); // 启用SMTP
|
|
||||||
$mail->Host = "smtp.126.com"; //SMTP服务器 163邮箱例子
|
|
||||||
$mail->Port = 465; //邮件发送端口
|
|
||||||
$mail->SMTPAuth = true; //启用SMTP认证
|
|
||||||
$mail->SMTPSecure = 'ssl';
|
|
||||||
$mail->CharSet = "UTF-8"; //字符集
|
|
||||||
$mail->Encoding = "base64"; //编码方式
|
|
||||||
$mail->Username = "tsf3920322@126.com"; //你的邮箱
|
|
||||||
$mail->Password = "HLWXNRPUCTHJFIIX"; //你的密码(邮箱后台的授权密码)
|
|
||||||
$mail->From = "tsf3920322@126.com"; //发件人地址(也就是你的邮箱)
|
|
||||||
|
|
||||||
// $mail->Subject = "微盟测试邮件"; //邮件标题
|
|
||||||
$mail->Subject = $content['title']; //邮件标题
|
|
||||||
|
|
||||||
// $mail->FromName = "微盟体测中心"; //发件人姓名
|
|
||||||
$mail->FromName = $content['from_user_name']; //发件人姓名
|
|
||||||
|
|
||||||
|
|
||||||
for ($i=0; $i < count($address); $i++) {
|
|
||||||
$mail->AddAddress($address[$i], ""); //添加收件人(地址,昵称)
|
|
||||||
}
|
|
||||||
|
|
||||||
if($annex != ''){
|
|
||||||
// $url = ROOT_PATH. 'public' . DS . 'tsf' . DS .'demoooo.jpg';
|
|
||||||
$mail->AddAttachment($annex,''); // 添加附件,并指定名称
|
|
||||||
}
|
|
||||||
|
|
||||||
$mail->IsHTML(true); //支持html格式内容
|
|
||||||
|
|
||||||
$neirong = $content['content'];
|
|
||||||
|
|
||||||
$mail->Body = $neirong; //邮件主体内容
|
|
||||||
//发送
|
|
||||||
if (!$mail->Send()) {
|
|
||||||
|
|
||||||
return ['code' => 10003,'msg'=>$mail->ErrorInfo];
|
|
||||||
// return $mail->ErrorInfo;
|
|
||||||
} else {
|
|
||||||
return ['code' => 0];
|
|
||||||
// return 'success';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 验证
|
// 验证
|
||||||
|
|
@ -143,9 +77,80 @@ class Base extends Controller{
|
||||||
}else if($type == 'other'){
|
}else if($type == 'other'){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
####################################################图片选择上传start##############################################################
|
||||||
|
public function pic_index($page = 1) {
|
||||||
|
$data = input();
|
||||||
|
$pd = true;
|
||||||
|
if(array_key_exists('page',$data)){
|
||||||
|
$page = $data['page'];
|
||||||
|
$pd = false;
|
||||||
|
}
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
$num = $cfc->table('app_user_upload_img')->where(['special_record_str'=>'admin'])->count();
|
||||||
|
$result = $cfc->table('app_user_upload_img')->where(['special_record_str'=>'admin'])->order('id desc')->page($page,20)->field('id,pic_url')->select();
|
||||||
|
if(!$pd){
|
||||||
|
$return_result['num'] = $num;
|
||||||
|
$return_result['result'] = $result;
|
||||||
|
return $this->msg(0,'success',$return_result);
|
||||||
|
}
|
||||||
|
$this->assign([
|
||||||
|
'result' => $result,
|
||||||
|
'num' => $num,
|
||||||
|
]);
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
public function pic_upload_action(){
|
||||||
|
|
||||||
|
$save_data = [];
|
||||||
|
$error_data = [];
|
||||||
|
// 获取表单上传文件
|
||||||
|
$files = request()->file('image');
|
||||||
|
foreach($files as $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_max,'ext'=>'jpg,png,gif'])->move(ROOT_PATH . 'public' . DS . 'kitchenscale_all' . DS . 'user_upload',$new_filename);
|
||||||
|
if($info){
|
||||||
|
array_push($save_data,[
|
||||||
|
'user_token'=>'caadd1be045a65f30b92aa805f1de54a',
|
||||||
|
'pic_name'=>$new_filename,
|
||||||
|
'pic_url'=>'https://tc.pcxbc.com/kitchenscale_all/user_upload/'.$new_filename,
|
||||||
|
'create_time'=>date('Y-m-d H:i:s'),
|
||||||
|
'special_record_str'=>'admin',
|
||||||
|
'operate_log'=>1
|
||||||
|
]);
|
||||||
|
}else{
|
||||||
|
array_push($error_data,[
|
||||||
|
'pic_name'=>$name,
|
||||||
|
'error_msg'=>$file->getError(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
$pic_result = $cfc->table('app_user_upload_img')->insertAll ($save_data);
|
||||||
|
if($pic_result){
|
||||||
|
return $this->msg(['success'=>count($save_data),'error_data'=>$error_data]);
|
||||||
|
}else{
|
||||||
|
for ($i=0; $i < count($save_data); $i++) {
|
||||||
|
unlink(ROOT_PATH . 'public' . DS . 'kitchenscale_all' . DS . 'user_upload' . DS . $new_filename);
|
||||||
|
}
|
||||||
|
return $this->msg(10002,'图片数据保存失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
####################################################图片选择上传end##############################################################
|
||||||
|
|
||||||
|
|
||||||
public function msg($data,$str='',$result = []){
|
public function msg($data,$str='',$result = []){
|
||||||
if(is_array($data)){
|
if(is_array($data)){
|
||||||
|
|
@ -162,9 +167,6 @@ class Base extends Controller{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ceshi(){
|
|
||||||
echo 'hello';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,178 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\KitchenScale\controller\admin;
|
||||||
|
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
|
class Cookbook extends Base{
|
||||||
|
|
||||||
|
// protected $login_hours_out = 24;
|
||||||
|
|
||||||
|
protected $page_num = 15;
|
||||||
|
|
||||||
|
// 加 bcadd(,,20)
|
||||||
|
// 减 bcsub(,,20)
|
||||||
|
// 乘 bcmul(,,20)
|
||||||
|
// 除 bcdiv(,,20)
|
||||||
|
################################################################接口################################################################
|
||||||
|
################################################################接口################################################################
|
||||||
|
################################################################接口################################################################
|
||||||
|
|
||||||
|
// 登录
|
||||||
|
public function index($page = 1){
|
||||||
|
$data = input();
|
||||||
|
$pd = true;
|
||||||
|
$parameter = [];
|
||||||
|
// $parameter['is_del'] = 0;
|
||||||
|
if(array_key_exists('tt', $data)){
|
||||||
|
$page = $data['page_num'];
|
||||||
|
unset($data['page_num']);
|
||||||
|
unset($data['tt']);
|
||||||
|
$pd = false;
|
||||||
|
// if($data['status_num'] === "0" || $data['status_num'] === "1"){
|
||||||
|
// $parameter['is_del'] = $data['status_num'];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if($data['tel']){
|
||||||
|
// $parameter['tel'] = $data['tel'];
|
||||||
|
// }
|
||||||
|
// if($data['email']){
|
||||||
|
// $parameter['email'] = $data['email'];
|
||||||
|
// }
|
||||||
|
// if($data['s_time']){
|
||||||
|
// $parameter['create_time'] = ['>=',$data['s_time']];
|
||||||
|
// }
|
||||||
|
// if($data['e_time']){
|
||||||
|
// $parameter['create_time'] = ['<=',$data['e_time']];
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
$where = '1=1';
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
$num = $cfc->table('app_user_cookbook')->where($parameter)->count();
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
a.id,
|
||||||
|
a.title,
|
||||||
|
a.create_user_nickname,
|
||||||
|
a.likes_num,
|
||||||
|
a.read_it,
|
||||||
|
a.is_del,
|
||||||
|
a.create_time,
|
||||||
|
b.pic_url
|
||||||
|
FROM
|
||||||
|
app_user_cookbook a
|
||||||
|
LEFT JOIN
|
||||||
|
app_user_upload_img b ON a.cover = b.id
|
||||||
|
WHERE
|
||||||
|
$where
|
||||||
|
ORDER BY
|
||||||
|
a.id DESC
|
||||||
|
OFFSET (".($page - 1)." * ".$this->page_num.") ROWS
|
||||||
|
FETCH NEXT ".$this->page_num." ROWS ONLY;
|
||||||
|
";
|
||||||
|
$result = $cfc->query($sql);
|
||||||
|
|
||||||
|
if(!$pd){
|
||||||
|
$return_data['num'] = $num;
|
||||||
|
$return_data['data'] = $result;
|
||||||
|
return $this->msg($return_data);
|
||||||
|
}
|
||||||
|
$this->assign([
|
||||||
|
'result' => $result,
|
||||||
|
'num' => $num,
|
||||||
|
]);
|
||||||
|
return $this->fetch();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add_cookbook(){
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
$result = $cfc->table('app_user_cookbook_label')->where(['is_del'=>0])->select();
|
||||||
|
$this->assign([
|
||||||
|
'result' => $result,
|
||||||
|
]);
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add_cookbook_action(){
|
||||||
|
$data = input();
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
// dump($data);
|
||||||
|
// 处理食谱数据
|
||||||
|
$id_list = [];
|
||||||
|
$food_cookbook_relationship = [];
|
||||||
|
foreach ($data['foodList'] as $key => $value) {
|
||||||
|
if(!in_array($value['id'],$id_list)){
|
||||||
|
array_push($id_list,$value['id']);
|
||||||
|
array_push($food_cookbook_relationship,[
|
||||||
|
'cookbook_id' => '',
|
||||||
|
'food_id' => $value['id']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$kcal_data = $cfc->table('app_z_national_standard_food_type_3')->where("id in (".implode(',',$id_list).")")->field('id,Calorie_val')->select();
|
||||||
|
for ($i=0; $i < count($kcal_data); $i++) {
|
||||||
|
$id_list[$kcal_data[$i]['id']] = $kcal_data[$i]['Calorie_val'];
|
||||||
|
}
|
||||||
|
foreach ($data['foodList'] as $key => $value) {
|
||||||
|
$data['foodList'][$key]['kcal'] = bcmul(bcdiv($value['weight'],100,20),$id_list[$value['id']],2);
|
||||||
|
$data['foodList'][$key]['unit'] = 'g';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置食谱信息
|
||||||
|
$cookbook_data = [
|
||||||
|
'title'=>$data['title'],
|
||||||
|
'cover'=>$data['cover'],
|
||||||
|
'create_user_token'=>'caadd1be045a65f30b92aa805f1de54a',
|
||||||
|
'create_user_head_pic'=>'https://tc.pcxbc.com/tsf/head_pic.png',
|
||||||
|
'create_user_nickname'=>'clown',
|
||||||
|
'describe_data'=>$data['description'],
|
||||||
|
'food_data'=>json_encode($data['foodList']),
|
||||||
|
'step_data'=>json_encode($data['stepList']),
|
||||||
|
'create_time'=>date('Y-m-d H:i:s'),
|
||||||
|
'original_cookbook_id'=>'admin',
|
||||||
|
'cook_label'=>$data['cook_label'],
|
||||||
|
'is_del'=>1,
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
$cfc->startTrans();
|
||||||
|
try {
|
||||||
|
|
||||||
|
$cookbook_id = $cfc->table('app_user_cookbook')->insertGetId($cookbook_data);
|
||||||
|
for ($i=0; $i < count($food_cookbook_relationship); $i++) {
|
||||||
|
$food_cookbook_relationship[$i]['cookbook_id'] = $cookbook_id;
|
||||||
|
}
|
||||||
|
$cfc->table('app_user_cookbook_food_relation')->insertAll($food_cookbook_relationship);
|
||||||
|
$cfc->commit();
|
||||||
|
return $this->msg([]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$cfc->rollback();
|
||||||
|
return $this->msg(10002,'数据保存失败,'.$e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stop_and_run(){
|
||||||
|
$data = input();
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
$result = $cfc->table('app_user_cookbook')->where(['id'=>$data['id']])->update(['is_del'=>$data['status']]);
|
||||||
|
if($result){
|
||||||
|
return $this->msg([]);
|
||||||
|
}else{
|
||||||
|
return $this->msg(10002);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function find_food_list(){
|
||||||
|
$data = input();
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
$result = $cfc->table('app_z_national_standard_food_type_3')->where("food_name like '%". $data['search_data'] ."%'")->field('id,food_name,Calorie_val')->select();
|
||||||
|
return $this->msg(0,'success',$result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\KitchenScale\controller\admin;
|
||||||
|
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
|
class Index extends Base{
|
||||||
|
|
||||||
|
// protected $login_hours_out = 24;
|
||||||
|
|
||||||
|
// 加 bcadd(,,20)
|
||||||
|
// 减 bcsub(,,20)
|
||||||
|
// 乘 bcmul(,,20)
|
||||||
|
// 除 bcdiv(,,20)
|
||||||
|
################################################################接口################################################################
|
||||||
|
################################################################接口################################################################
|
||||||
|
################################################################接口################################################################
|
||||||
|
|
||||||
|
// 登录
|
||||||
|
public function index(){
|
||||||
|
// $this->assign('domain',$a);
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function welcome(){
|
||||||
|
// $this->assign('domain',$a);
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@ use think\Db;
|
||||||
|
|
||||||
class Login extends Base{
|
class Login extends Base{
|
||||||
|
|
||||||
protected $login_hours_out = 24;
|
// protected $login_hours_out = 24;
|
||||||
|
|
||||||
// 加 bcadd(,,20)
|
// 加 bcadd(,,20)
|
||||||
// 减 bcsub(,,20)
|
// 减 bcsub(,,20)
|
||||||
|
|
@ -16,103 +16,24 @@ class Login extends Base{
|
||||||
################################################################接口################################################################
|
################################################################接口################################################################
|
||||||
################################################################接口################################################################
|
################################################################接口################################################################
|
||||||
|
|
||||||
// 登录请求api
|
// 登录
|
||||||
public function login($data = ['account'=>123,'password'=>456]){
|
public function login(){
|
||||||
// try {
|
return $this->fetch();
|
||||||
// 你的业务逻辑
|
|
||||||
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 check_login($data = ['token'=>'123']){
|
public function login_action(){
|
||||||
// try {
|
$data = input();
|
||||||
// 你的业务逻辑
|
// 验证数据项是否完整
|
||||||
if(count(input('post.')) > 0){
|
if(!array_key_exists('username', $data) || !array_key_exists('password', $data)){
|
||||||
$data = input('post.');
|
|
||||||
}
|
|
||||||
if(!array_key_exists('token', $data)){
|
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
$return_data = $this->check_login_action($data);
|
$account = $cfc->table('admin_user_account_number')->where(['account_num'=>$data['username'],'password'=>$data['password']])->count();
|
||||||
|
if($account>0){
|
||||||
// 成功
|
|
||||||
$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 login_action($data){
|
|
||||||
// dump($data);
|
|
||||||
$user = Db::table('admin_user_account_number')->where(["account_num"=>$data['account'],'password'=>$data['password']])->find();
|
|
||||||
// dump($user);
|
|
||||||
// die;
|
|
||||||
if($user){
|
|
||||||
return $this->msg(['token'=>$user['token']]);
|
|
||||||
}else{
|
|
||||||
return $this->msg(10004);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function check_login_action(){
|
|
||||||
$user = Db::table('admin_user_account_number')->where(["token"=>$data['token']])->field('create_time')->find();
|
|
||||||
if (!$user) {
|
|
||||||
return $this->msg(10001); // 如果用户不存在,直接返回 false
|
|
||||||
}
|
|
||||||
// 假设 $user['create_time'] 是一个日期时间字符串
|
|
||||||
$createTime = new DateTime($user['create_time']);
|
|
||||||
$currentTime = new DateTime();
|
|
||||||
|
|
||||||
// 计算时间差
|
|
||||||
$interval = $currentTime->diff($createTime);
|
|
||||||
|
|
||||||
// 判断时间差是否超过指定小时数
|
|
||||||
$totalHours = $interval->days * 24 + $interval->h;
|
|
||||||
if ($totalHours > $this->login_hours_out) {
|
|
||||||
return $this->msg(10001);
|
|
||||||
} else {
|
|
||||||
return $this->msg([]);
|
return $this->msg([]);
|
||||||
|
}else{
|
||||||
|
return $this->msg(10003);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -495,7 +495,7 @@ class Cookbook extends Base{
|
||||||
// 获取查询页页面导航食材列表
|
// 获取查询页页面导航食材列表
|
||||||
public function get_search_food_page_list($data=['token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
public function get_search_food_page_list($data=['token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||||||
// 尝试捕获异常
|
// 尝试捕获异常
|
||||||
try {
|
// try {
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
}
|
}
|
||||||
|
|
@ -508,20 +508,20 @@ class Cookbook extends Base{
|
||||||
|
|
||||||
$return_data = $this->get_search_food_page_list_action($data);
|
$return_data = $this->get_search_food_page_list_action($data);
|
||||||
return $return_data;
|
return $return_data;
|
||||||
} catch (\Exception $e) {
|
// } catch (\Exception $e) {
|
||||||
// 捕获异常
|
// // 捕获异常
|
||||||
$logContent["flie"] = $e->getFile();
|
// $logContent["flie"] = $e->getFile();
|
||||||
$logContent["line"] = $e->getLine();
|
// $logContent["line"] = $e->getLine();
|
||||||
$logContent['all_content'] = "异常信息:\n";
|
// $logContent['all_content'] = "异常信息:\n";
|
||||||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
// 记录日志
|
// // 记录日志
|
||||||
$this->record_api_log($data, $logContent, null);
|
// $this->record_api_log($data, $logContent, null);
|
||||||
return json(['status' => 'error', 'message' => '系统错误']);
|
// return json(['status' => 'error', 'message' => '系统错误']);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
#######################################################################action#######################################################################
|
#######################################################################action#######################################################################
|
||||||
|
|
@ -742,7 +742,7 @@ class Cookbook extends Base{
|
||||||
->join($this->kitchenscale_db_msg['uploadimg'].' b','a.cover = b.id','LEFT')
|
->join($this->kitchenscale_db_msg['uploadimg'].' b','a.cover = b.id','LEFT')
|
||||||
->where(['a.cook_label'=>$cook_label,'a.is_del'=>0])
|
->where(['a.cook_label'=>$cook_label,'a.is_del'=>0])
|
||||||
->field('a.id,a.title,b.pic_url as cover,a.create_user_head_pic,a.create_user_nickname,a.likes_num')
|
->field('a.id,a.title,b.pic_url as cover,a.create_user_head_pic,a.create_user_nickname,a.likes_num')
|
||||||
->order('id DESC')
|
// ->order('id DESC')
|
||||||
->page("$page_now,$page_num")
|
->page("$page_now,$page_num")
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
|
|
@ -982,33 +982,45 @@ class Cookbook extends Base{
|
||||||
'desc'=>'重量',
|
'desc'=>'重量',
|
||||||
'list'=>$cookbook_data['food_data'],
|
'list'=>$cookbook_data['food_data'],
|
||||||
]);
|
]);
|
||||||
|
if(count($nutrition)>0){
|
||||||
array_push($cookbook_data['tags'],[
|
array_push($cookbook_data['tags'],[
|
||||||
'title'=>'能量',
|
'title'=>'能量',
|
||||||
'desc'=>'含量',
|
'desc'=>'含量',
|
||||||
'list'=>$nutrition,
|
'list'=>$nutrition,
|
||||||
]);
|
]);
|
||||||
|
}else{
|
||||||
|
array_push($cookbook_data['tags'],[
|
||||||
|
'title'=>'',
|
||||||
|
'desc'=>'',
|
||||||
|
'list'=>[],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if(count($vitamin)>0){
|
||||||
array_push($cookbook_data['tags'],[
|
array_push($cookbook_data['tags'],[
|
||||||
'title'=>'维生素',
|
'title'=>'维生素',
|
||||||
'desc'=>'含量',
|
'desc'=>'含量',
|
||||||
'list'=>$vitamin,
|
'list'=>$vitamin,
|
||||||
]);
|
]);
|
||||||
|
}else{
|
||||||
|
array_push($cookbook_data['tags'],[
|
||||||
|
'title'=>'',
|
||||||
|
'desc'=>'',
|
||||||
|
'list'=>[],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if(count($mineral)>0){
|
||||||
array_push($cookbook_data['tags'],[
|
array_push($cookbook_data['tags'],[
|
||||||
'title'=>'矿物质',
|
'title'=>'矿物质',
|
||||||
'desc'=>'含量',
|
'desc'=>'含量',
|
||||||
'list'=>$mineral,
|
'list'=>$mineral,
|
||||||
]);
|
]);
|
||||||
|
}else{
|
||||||
|
array_push($cookbook_data['tags'],[
|
||||||
// $cookbook_data['nutrition']['list'] = $nutrition;
|
'title'=>'',
|
||||||
// // $cookbook_data['nutrition']['title'] = '能量及宏量营养素';
|
'desc'=>'',
|
||||||
// $cookbook_data['nutrition']['title'] = '能量';
|
'list'=>[],
|
||||||
// $cookbook_data['nutrition']['desc'] = '含量';
|
]);
|
||||||
// $cookbook_data['vitamin']['list'] = $vitamin;
|
}
|
||||||
// $cookbook_data['vitamin']['title'] = '维生素';
|
|
||||||
// $cookbook_data['vitamin']['desc'] = '含量';
|
|
||||||
// $cookbook_data['mineral']['list'] = $mineral;
|
|
||||||
// $cookbook_data['mineral']['title'] = '矿物质';
|
|
||||||
// $cookbook_data['mineral']['desc'] = '含量';
|
|
||||||
|
|
||||||
$cookbook_data['token'] = $cookbook_data['create_user_token'];
|
$cookbook_data['token'] = $cookbook_data['create_user_token'];
|
||||||
$cookbook_data['description'] = $cookbook_data['describe_data'];
|
$cookbook_data['description'] = $cookbook_data['describe_data'];
|
||||||
|
|
@ -1024,6 +1036,7 @@ class Cookbook extends Base{
|
||||||
unset($cookbook_data['is_del']);
|
unset($cookbook_data['is_del']);
|
||||||
return $this->msg($cookbook_data);
|
return $this->msg($cookbook_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cookbook_follow_action($data){
|
public function cookbook_follow_action($data){
|
||||||
// 获取账号下信息以及用户信息
|
// 获取账号下信息以及用户信息
|
||||||
$user_data = Db::table($this->reedaw_db_msg['zhanghao'])->where(['token'=>$data['token']])->field('id,token,nickname,head_pic')->find();
|
$user_data = Db::table($this->reedaw_db_msg['zhanghao'])->where(['token'=>$data['token']])->field('id,token,nickname,head_pic')->find();
|
||||||
|
|
@ -1176,10 +1189,17 @@ class Cookbook extends Base{
|
||||||
");
|
");
|
||||||
|
|
||||||
if(count($food_data)>0){
|
if(count($food_data)>0){
|
||||||
|
for ($i=0; $i < count($food_data); $i++) {
|
||||||
|
if($food_data[$i]['pic_url'] != ''){
|
||||||
|
$food_data[$i]['pic_url'] = 'https://tc.pcxbc.com/kitchenscale_all'.$food_data[$i]['pic_url'];
|
||||||
|
}
|
||||||
|
}
|
||||||
return $this->msg($food_data);
|
return $this->msg($food_data);
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10004,'未找到该食材');
|
return $this->msg(10004,'未找到该食材');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public function get_food_list_action($data){
|
public function get_food_list_action($data){
|
||||||
|
|
||||||
|
|
@ -1201,7 +1221,7 @@ class Cookbook extends Base{
|
||||||
if($data['search_data'] === ""){
|
if($data['search_data'] === ""){
|
||||||
$data['search_data'] = "";
|
$data['search_data'] = "";
|
||||||
}else{
|
}else{
|
||||||
$data['search_data'] = " AND name LIKE '%".$data['search_data']."%'";
|
$data['search_data'] = " AND food_name LIKE '%".$data['search_data']."%'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$search_sql_str = $search_sql_str.$data['search_data'];
|
$search_sql_str = $search_sql_str.$data['search_data'];
|
||||||
|
|
@ -1286,7 +1306,7 @@ class Cookbook extends Base{
|
||||||
// 肉类id:10 11 14
|
// 肉类id:10 11 14
|
||||||
$data_list = $cfc->table($this->kitchenscale_db_msg['foodlist3'])
|
$data_list = $cfc->table($this->kitchenscale_db_msg['foodlist3'])
|
||||||
->where('two_id in (4,6,7,10,11,14) and is_popular = 1')
|
->where('two_id in (4,6,7,10,11,14) and is_popular = 1')
|
||||||
->field('id,name,two_id')
|
->field('id,food_name,two_id')
|
||||||
->select();
|
->select();
|
||||||
$result = [
|
$result = [
|
||||||
'food'=>[
|
'food'=>[
|
||||||
|
|
@ -1306,9 +1326,9 @@ class Cookbook extends Base{
|
||||||
];
|
];
|
||||||
foreach ($data_list as $key => $value) {
|
foreach ($data_list as $key => $value) {
|
||||||
if($value['two_id'] == 4 || $value['two_id'] == 6 || $value['two_id'] == 7){
|
if($value['two_id'] == 4 || $value['two_id'] == 6 || $value['two_id'] == 7){
|
||||||
array_push($result['food']['list'][0]['list'],['id'=>$value['id'],'name'=>$value['name']]);
|
array_push($result['food']['list'][0]['list'],['id'=>$value['id'],'name'=>$value['food_name']]);
|
||||||
}else if($value['two_id'] == 10 || $value['two_id'] == 11 || $value['two_id'] == 14){
|
}else if($value['two_id'] == 10 || $value['two_id'] == 11 || $value['two_id'] == 14){
|
||||||
array_push($result['food']['list'][1]['list'],['id'=>$value['id'],'name'=>$value['name']]);
|
array_push($result['food']['list'][1]['list'],['id'=>$value['id'],'name'=>$value['food_name']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,209 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html class="x-admin-sm">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>图片管理</title>
|
||||||
|
<meta name="renderer" content="webkit|ie-comp|ie-stand">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||||
|
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||||
|
<script type="text/javascript" src="/x_admin/js/jq.js"></script>
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/font.css">
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/xadmin.css">
|
||||||
|
<script type="text/javascript" src="/x_admin/lib/layui/layui.js" charset="utf-8"></script>
|
||||||
|
<script type="text/javascript" src="/x_admin/js/xadmin.js"></script>
|
||||||
|
<style>
|
||||||
|
.content{
|
||||||
|
width: 100%;
|
||||||
|
max-height: 70%;
|
||||||
|
overflow: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-content: center;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
}
|
||||||
|
.pic_box_upload{
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
margin: 5px 5px;
|
||||||
|
}
|
||||||
|
.pic_box_upload img{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.pic_box{
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
margin: 5px 5px;
|
||||||
|
}
|
||||||
|
.pic_box:hover {
|
||||||
|
box-shadow: 0px 0px 1px;
|
||||||
|
}
|
||||||
|
.pic_box img{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
#fileInput {
|
||||||
|
display: none; /* 隐藏文件输入元素 */
|
||||||
|
}
|
||||||
|
.jz{
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: auto 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="content">
|
||||||
|
<div class="pic_box_upload" onclick="upload_action()"><img src="https://tc.pcxbc.com/tsf/upload_pic.jpg" alt=""></div>
|
||||||
|
{volist name="result" id="vo"}
|
||||||
|
<div class="pic_box" onclick="sendParamToParent('{$vo.id}','{$vo.pic_url}')"><img src="{$vo.pic_url}" alt=""></div>
|
||||||
|
{/volist}
|
||||||
|
</div>
|
||||||
|
<div class="layui-card-body jz">
|
||||||
|
<div id="page" style="text-align: center;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="file" id="fileInput" multiple>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var page_num;
|
||||||
|
var laypage;
|
||||||
|
var all_page = "{$num}";
|
||||||
|
layui.use('laypage', function () {
|
||||||
|
laypage = layui.laypage;
|
||||||
|
laypage.render({
|
||||||
|
elem: 'page',
|
||||||
|
count: all_page, //数据总数,从服务端得到
|
||||||
|
limit: 20,
|
||||||
|
groups:20,
|
||||||
|
jump: function (obj, first) {
|
||||||
|
//首次不执行
|
||||||
|
if (!first) {
|
||||||
|
//obj包含了当前分页的所有参数,比如:
|
||||||
|
console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
|
||||||
|
console.log(obj.limit); //得到每页显示的条数
|
||||||
|
page_num = obj.curr;
|
||||||
|
jump_page(page_num)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function jump_page(num){
|
||||||
|
load()
|
||||||
|
$.ajax({
|
||||||
|
url: "/k/admin/pic", //请求的url地址s
|
||||||
|
dataType: "json", //返回格式为json
|
||||||
|
async: true,//请求是否异步,默认为异步,这也是ajax重要特性
|
||||||
|
data: {'page': num}, //参数值
|
||||||
|
type: "POST", //请求方式
|
||||||
|
success: function (req) {
|
||||||
|
console.log(req)
|
||||||
|
c_load();
|
||||||
|
if(req['code'] == 0){
|
||||||
|
var str,str_s,str_all="";
|
||||||
|
for (let i = 0; i < req['data']['result'].length; i++) {
|
||||||
|
str = '<div class="pic_box" onclick="sendParamToParent(\''+req['data']['result'][i]['id']+'\',\''+req['data']['result'][i]['url_data']+'\')"><img src="'+req['data']['result'][i]['url_data']+'" alt=""></div>'
|
||||||
|
str_all = str_all+str;
|
||||||
|
}
|
||||||
|
$('.content').each(function() {
|
||||||
|
$(this).find('.pic_box').remove();
|
||||||
|
});
|
||||||
|
$('.content').append(str_all);
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
//请求出错处理
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function sendParamToParent(id,data) {
|
||||||
|
var param = [id,data]; // 这是要传递的参数
|
||||||
|
// 调用父窗口的一个函数,并传递参数
|
||||||
|
if (window.parent && window.parent.receiveParamFromIframe) {
|
||||||
|
window.parent.receiveParamFromIframe(param);
|
||||||
|
} else {
|
||||||
|
layer.msg('图片选择失败');
|
||||||
|
}
|
||||||
|
xadmin.close();
|
||||||
|
}
|
||||||
|
function upload_action(){
|
||||||
|
document.getElementById('fileInput').click();
|
||||||
|
}
|
||||||
|
$('#fileInput').on('change', function() {
|
||||||
|
// 获取所有被选择的文件
|
||||||
|
var fileInput = $(this)[0];
|
||||||
|
var files = fileInput.files;
|
||||||
|
// 检查是否有文件被选择
|
||||||
|
if (files.length > 0) {
|
||||||
|
load()
|
||||||
|
var formdata = new FormData();
|
||||||
|
// 添加所有文件到FormData
|
||||||
|
for (var i = 0; i < files.length; i++) {
|
||||||
|
formdata.append('image[]', files[i]); // 注意这里改为数组形式
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url:"/k/admin/pic_upload_action", //请求的url地址
|
||||||
|
contentType:false,
|
||||||
|
processData:false,
|
||||||
|
async:true,//请求是否异步,默认为异步,这也是ajax重要特性
|
||||||
|
data:formdata, //参数值
|
||||||
|
type:"POST", //请求方式
|
||||||
|
success:function(req){
|
||||||
|
c_load()
|
||||||
|
//请求成功时处理
|
||||||
|
if(req.code == 0){
|
||||||
|
var content = '<div style="padding:20px;">';
|
||||||
|
content += '<p>成功上传:' + req.data.success + '个文件</p>';
|
||||||
|
if (req.data.error_data && req.data.error_data.length > 0) {
|
||||||
|
content += '<p>失败文件:</p><ul style="margin-left:20px;">';
|
||||||
|
req.data.error_data.forEach(function(item) {
|
||||||
|
content += '<li>' + item.pic_name + ' (' + item.error_msg + ')</li>';
|
||||||
|
});
|
||||||
|
content += '</ul>';
|
||||||
|
}
|
||||||
|
content += '</div>';
|
||||||
|
layer.open({
|
||||||
|
type: 1,
|
||||||
|
title: '上传结果',
|
||||||
|
area: ['500px', '300px'], // 宽高
|
||||||
|
content: content,
|
||||||
|
btn: ['确定'],
|
||||||
|
yes: function(index, layero) {
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
cancel: function() {
|
||||||
|
window.location.reload(); // 点击右上角关闭也刷新
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
layer.msg(req.msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error:function(){
|
||||||
|
//请求出错处理
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//加载提示开启
|
||||||
|
function load() {
|
||||||
|
var index = layer.load(1, {
|
||||||
|
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 关闭加载提示
|
||||||
|
function c_load() {
|
||||||
|
layer.close(layer.index)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,420 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="x-admin-sm">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>菜谱管理</title>
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/font.css">
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/xadmin.css">
|
||||||
|
<script type="text/javascript" src="/x_admin/lib/layui/layui.js" charset="utf-8"></script>
|
||||||
|
<script type="text/javascript" src="/x_admin/js/xadmin.js"></script>
|
||||||
|
<script type="text/javascript" src="/x_admin/js/jq.js"></script>
|
||||||
|
<style>
|
||||||
|
.step-container {
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
border: 1px solid #eee;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.step-content {
|
||||||
|
flex: 1;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
.step-image {
|
||||||
|
width: 200px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.step-preview {
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 150px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.step-buttons {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layui-fluid">
|
||||||
|
<div class="layui-row">
|
||||||
|
<form class="layui-form layui-form-pane">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label" style="width: 120px; text-align: right;">
|
||||||
|
<span class="x-red">☆</span>菜谱标题
|
||||||
|
</label>
|
||||||
|
<div class="layui-input-inline" style="width: 80%;">
|
||||||
|
<input type="text" id="recipe_title" name="recipe_title" required lay-verify="required" autocomplete="off" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- 图片选择器html部分 -->
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label" style="width: 120px; text-align: right;">
|
||||||
|
<span class="x-red">★</span>选择封面
|
||||||
|
</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<div class="layui-btn" onclick="openImageManager('preview_img', 'cove_img')">点击选择</div>
|
||||||
|
<input type="hidden" id="cove_img" name="cove_img">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label" style="width: 120px; text-align: right;">
|
||||||
|
<span class="x-red"></span>预览
|
||||||
|
</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<img id="preview_img" style="max-width: 200px; display: none; border: 1px solid #eee; margin-top: 10px;" src="" alt="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- 图片选择器html部分 -->
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label" style="width: 120px; text-align: right;">
|
||||||
|
<span class="x-red">☆</span>菜谱类型
|
||||||
|
</label>
|
||||||
|
<div class="layui-input-inline" style="width: 80%;">
|
||||||
|
<select name="recipe_type" lay-verify="required" id="recipe_type">
|
||||||
|
<option value="0">请选择菜谱类型</option>
|
||||||
|
{volist name="result" id="vo"}
|
||||||
|
<option value="{$vo.id}">{$vo.name}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label" style="width: 120px; text-align: right;">
|
||||||
|
<span class="x-red">☆</span>菜谱描述
|
||||||
|
</label>
|
||||||
|
<div class="layui-input-inline" style="width: 80%;">
|
||||||
|
<textarea name="recipe_desc" id="recipe_desc" required lay-verify="required" placeholder="请输入菜谱描述" class="layui-textarea"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label" style="width: 120px; text-align: right;">
|
||||||
|
<span class="x-red">☆</span>食材
|
||||||
|
</label>
|
||||||
|
<div class="layui-input-inline" style="width: 80%;">
|
||||||
|
<div id="ingredients_container">
|
||||||
|
<div class="layui-form-item ingredient-item" style="margin-bottom: 10px;">
|
||||||
|
<div class="layui-inline">
|
||||||
|
<input type="text" name="ingredient_name[]" placeholder="食材名称" autocomplete="off" class="layui-input ingredient-name" style="width: 150px; display: inline-block;">
|
||||||
|
<div class="ingredient-suggest" style="position: absolute; z-index: 999; display: none; width: 150px; max-height: 200px; overflow-y: auto; border: 1px solid #d2d2d2; background: #fff;"></div>
|
||||||
|
<input type="text" name="ingredient_amount[]" placeholder="用量(g)" autocomplete="off" class="layui-input" style="width: 100px; display: inline-block; margin-left: 10px;">
|
||||||
|
<button type="button" class="layui-btn layui-btn-danger layui-btn-xs remove-ingredient" style="margin-left: 10px;">删除</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" id="add_ingredient" class="layui-btn layui-btn-xs">添加食材</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label" style="width: 120px; text-align: right;">
|
||||||
|
<span class="x-red">☆</span>步骤
|
||||||
|
</label>
|
||||||
|
<div class="layui-input-inline" style="width: 80%;">
|
||||||
|
<div id="steps_container">
|
||||||
|
<div class="step-container">
|
||||||
|
<div class="step-content">
|
||||||
|
<label class="layui-form-label" style="width: auto; padding: 9px 5px; text-align: left;">步骤1</label>
|
||||||
|
<textarea name="step_desc[]" placeholder="请输入步骤描述" class="layui-textarea"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="step-image">
|
||||||
|
<img class="step-preview" src="" alt="步骤图片预览">
|
||||||
|
<input type="hidden" class="step-image-id" name="step_image[]" value="">
|
||||||
|
<div class="step-buttons">
|
||||||
|
<button type="button" class="layui-btn layui-btn-xs select-step-image">选择图片</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-danger layui-btn-xs remove-step">删除步骤</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" id="add_step" class="layui-btn layui-btn-xs">添加步骤</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item" style="display: flex;flex-direction: row;justify-content: center;">
|
||||||
|
<button class="layui-btn" lay-filter="add" lay-submit="" style="width: 150px;">增加</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
// 图片选择器js部分~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// 全局变量存储当前操作的预览和隐藏字段ID
|
||||||
|
var currentImageSelection = {
|
||||||
|
previewId: '',
|
||||||
|
hiddenFieldId: ''
|
||||||
|
};
|
||||||
|
// 打开图片管理器函数
|
||||||
|
function openImageManager(previewId, hiddenFieldId) {
|
||||||
|
// 存储当前操作的ID
|
||||||
|
currentImageSelection.previewId = previewId;
|
||||||
|
currentImageSelection.hiddenFieldId = hiddenFieldId;
|
||||||
|
|
||||||
|
// 打开图片管理窗口
|
||||||
|
xadmin.open('图片管理', '/k/admin/pic', '80%', '80%');
|
||||||
|
}
|
||||||
|
// 接收从图片管理窗口返回的参数
|
||||||
|
function receiveParamFromIframe(param) {
|
||||||
|
if(param.length > 0 && currentImageSelection.previewId && currentImageSelection.hiddenFieldId){
|
||||||
|
// 更新预览图片
|
||||||
|
var img = document.getElementById(currentImageSelection.previewId);
|
||||||
|
img.src = param[1];
|
||||||
|
img.style.display = 'block';
|
||||||
|
|
||||||
|
// 更新隐藏字段值
|
||||||
|
document.getElementById(currentImageSelection.hiddenFieldId).value = param[0];
|
||||||
|
|
||||||
|
// 重置当前操作的ID
|
||||||
|
currentImageSelection.previewId = '';
|
||||||
|
currentImageSelection.hiddenFieldId = '';
|
||||||
|
} else {
|
||||||
|
layer.msg('图片选择失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 图片选择器js部分~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
$(document).ready(function(){
|
||||||
|
var stepCounter = 1;
|
||||||
|
var ingredientCounter = 1;
|
||||||
|
|
||||||
|
// 添加食材
|
||||||
|
$('#add_ingredient').on('click', function() {
|
||||||
|
ingredientCounter++;
|
||||||
|
var html = `
|
||||||
|
<div class="layui-form-item ingredient-item" style="margin-bottom: 10px;">
|
||||||
|
<div class="layui-inline">
|
||||||
|
<input type="text" name="ingredient_name[]" placeholder="食材名称" autocomplete="off" class="layui-input ingredient-name" style="width: 150px; display: inline-block;">
|
||||||
|
<div class="ingredient-suggest" style="position: absolute; z-index: 999; display: none; width: 150px; max-height: 200px; overflow-y: auto; border: 1px solid #d2d2d2; background: #fff;"></div>
|
||||||
|
<input type="text" name="ingredient_amount[]" placeholder="用量(g)" autocomplete="off" class="layui-input" style="width: 100px; display: inline-block; margin-left: 10px;">
|
||||||
|
<button type="button" class="layui-btn layui-btn-danger layui-btn-xs remove-ingredient" style="margin-left: 10px;">删除</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
$('#ingredients_container').append(html);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 食材名称输入自动完成
|
||||||
|
$(document).on('input', '.ingredient-name', function() {
|
||||||
|
var input = $(this);
|
||||||
|
var keyword = input.val().trim();
|
||||||
|
var suggestBox = input.next('.ingredient-suggest');
|
||||||
|
|
||||||
|
if (keyword.length < 1) {
|
||||||
|
suggestBox.hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(keyword)
|
||||||
|
// 发送AJAX请求
|
||||||
|
$.ajax({
|
||||||
|
url: '/k/a/cookbook/find_food_list',
|
||||||
|
dataType:"json", //返回格式为json
|
||||||
|
async:true,//请求是否异步,默认为异步,这也是ajax重要特性
|
||||||
|
data:{"id":"value"}, //参数值
|
||||||
|
data: {'search_data': keyword},
|
||||||
|
type: 'POST',
|
||||||
|
success: function(res) {
|
||||||
|
if (res.code === 0 && res.data && res.data.length > 0) {
|
||||||
|
var html = '';
|
||||||
|
res.data.forEach(function(item) {
|
||||||
|
html += '<div class="suggest-item" style="padding: 5px 10px; cursor: pointer;" data-id="' + item.id + '" data-name="' + item.food_name + '" data-kcal="' + item.Calorie_val + '">' + item.food_name + '</div>';
|
||||||
|
});
|
||||||
|
suggestBox.html(html).show();
|
||||||
|
} else {
|
||||||
|
suggestBox.hide();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
suggestBox.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 点击建议项填充到输入框
|
||||||
|
$(document).on('click', '.suggest-item', function() {
|
||||||
|
var id = $(this).data('id');
|
||||||
|
var name = $(this).data('name');
|
||||||
|
var kcal = $(this).data('kcal');
|
||||||
|
|
||||||
|
var parentDiv = $(this).closest('.layui-inline');
|
||||||
|
parentDiv.find('.ingredient-name').val(name).data('id', id).data('kcal', kcal);
|
||||||
|
parentDiv.find('.ingredient-suggest').hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 点击其他地方隐藏建议框并清空输入框
|
||||||
|
$(document).on('click', function(e) {
|
||||||
|
if (!$(e.target).closest('.ingredient-suggest').length && !$(e.target).hasClass('ingredient-name')) {
|
||||||
|
$('.ingredient-suggest').hide();
|
||||||
|
// 清空未选择食材的输入框
|
||||||
|
$('.ingredient-name').each(function() {
|
||||||
|
if (!$(this).data('id')) { // 如果没有选择过食材(没有data-id)
|
||||||
|
$(this).val(''); // 清空输入框
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 删除食材
|
||||||
|
$(document).on('click', '.remove-ingredient', function() {
|
||||||
|
if($('.ingredient-item').length > 1) {
|
||||||
|
$(this).closest('.ingredient-item').remove();
|
||||||
|
} else {
|
||||||
|
layer.msg('至少保留一个食材');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 添加步骤
|
||||||
|
$('#add_step').on('click', function() {
|
||||||
|
stepCounter++;
|
||||||
|
var html = `
|
||||||
|
<div class="step-container">
|
||||||
|
<div class="step-content">
|
||||||
|
<label class="layui-form-label" style="width: auto; padding: 9px 5px; text-align: left;">步骤${stepCounter}</label>
|
||||||
|
<textarea name="step_desc[]" placeholder="请输入步骤描述" class="layui-textarea"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="step-image">
|
||||||
|
<img class="step-preview" src="" alt="步骤图片预览">
|
||||||
|
<input type="hidden" class="step-image-id" name="step_image[]" value="">
|
||||||
|
<div class="step-buttons">
|
||||||
|
<button type="button" class="layui-btn layui-btn-xs select-step-image">选择图片</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-danger layui-btn-xs remove-step">删除步骤</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
$('#steps_container').append(html);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 为步骤选择图片
|
||||||
|
$(document).on('click', '.select-step-image', function() {
|
||||||
|
var container = $(this).closest('.step-container');
|
||||||
|
var previewImg = container.find('.step-preview');
|
||||||
|
var hiddenInput = container.find('.step-image-id');
|
||||||
|
|
||||||
|
// 为元素设置唯一ID
|
||||||
|
var previewId = 'step-preview-' + Math.random().toString(36).substr(2, 9);
|
||||||
|
var hiddenId = 'step-image-' + Math.random().toString(36).substr(2, 9);
|
||||||
|
|
||||||
|
previewImg.attr('id', previewId);
|
||||||
|
hiddenInput.attr('id', hiddenId);
|
||||||
|
|
||||||
|
// 打开图片管理器
|
||||||
|
openImageManager(previewId, hiddenId);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 删除步骤
|
||||||
|
$(document).on('click', '.remove-step', function() {
|
||||||
|
if($('.step-container').length > 1) {
|
||||||
|
$(this).closest('.step-container').remove();
|
||||||
|
// 重新编号步骤
|
||||||
|
$('.step-container').each(function(index) {
|
||||||
|
$(this).find('.layui-form-label').text('步骤' + (index + 1));
|
||||||
|
});
|
||||||
|
stepCounter--;
|
||||||
|
} else {
|
||||||
|
layer.msg('至少保留一个步骤');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 表单提交时收集数据
|
||||||
|
layui.use(['form', 'layer'], function() {
|
||||||
|
var form = layui.form,
|
||||||
|
layer = layui.layer;
|
||||||
|
|
||||||
|
// 监听提交
|
||||||
|
form.on('submit(add)', function(data) {
|
||||||
|
// 显示加载中
|
||||||
|
var loadIndex = layer.load(1);
|
||||||
|
|
||||||
|
// 收集表单数据
|
||||||
|
var formData = {
|
||||||
|
cook_label: $('#recipe_type').val(),
|
||||||
|
title: $('#recipe_title').val(),
|
||||||
|
description: $('#recipe_desc').val(),
|
||||||
|
cover: $('#cove_img').val(), // 封面图片ID
|
||||||
|
foodList: [],
|
||||||
|
stepList: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// 收集食材数据
|
||||||
|
$('.ingredient-item').each(function() {
|
||||||
|
var nameInput = $(this).find('.ingredient-name');
|
||||||
|
var amountInput = $(this).find('input[placeholder="用量(g)"]');
|
||||||
|
|
||||||
|
var id = nameInput.data('id');
|
||||||
|
var name = nameInput.val();
|
||||||
|
var weight = amountInput.val();
|
||||||
|
|
||||||
|
if (id && name && weight && weight > 0) {
|
||||||
|
formData.foodList.push({
|
||||||
|
id: id,
|
||||||
|
name: name,
|
||||||
|
weight: weight
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 收集步骤数据
|
||||||
|
$('.step-container').each(function() {
|
||||||
|
var desc = $(this).find('textarea').val();
|
||||||
|
var imageId = $(this).find('.step-image-id').val();
|
||||||
|
|
||||||
|
if (desc && desc.trim() !== '') {
|
||||||
|
formData.stepList.push({
|
||||||
|
pic_list: [imageId] || [],
|
||||||
|
description: desc.trim()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调试输出
|
||||||
|
console.log('提交数据:', formData);
|
||||||
|
|
||||||
|
// 发送AJAX请求
|
||||||
|
$.ajax({
|
||||||
|
url: "/k/a/cookbook/add_cookbook_action",
|
||||||
|
type: "POST",
|
||||||
|
data: JSON.stringify(formData),
|
||||||
|
contentType: "application/json",
|
||||||
|
success: function(res) {
|
||||||
|
layer.close(loadIndex);
|
||||||
|
if (res.code === 0) {
|
||||||
|
layer.alert("添加成功", {icon: 1}, function() {
|
||||||
|
xadmin.close();
|
||||||
|
xadmin.father_reload();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.alert("添加失败:" + res.msg, {icon: 2});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
layer.close(loadIndex);
|
||||||
|
layer.alert("请求失败,请稍后再试", {icon: 2});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//加载提示开启
|
||||||
|
function load() {
|
||||||
|
var index = layer.load(1, {
|
||||||
|
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 关闭加载提示
|
||||||
|
function c_load() {
|
||||||
|
layer.close(layer.index)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,232 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="x-admin-sm">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>app版本管理</title>
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/font.css">
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/xadmin.css">
|
||||||
|
<script type="text/javascript" src="/x_admin/lib/layui/layui.js" charset="utf-8"></script>
|
||||||
|
<script type="text/javascript" src="/x_admin/js/xadmin.js"></script>
|
||||||
|
<script type="text/javascript" src="/x_admin/js/jq.js"></script>
|
||||||
|
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
||||||
|
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layui-fluid">
|
||||||
|
<div class="layui-row">
|
||||||
|
<form class="layui-form">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="L_email" class="layui-form-label">
|
||||||
|
<span class="x-red"></span>卡片图标</label>
|
||||||
|
</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<!-- <input type="text" id="L_email" name="email" required="" lay-verify="email" autocomplete="off" class="layui-input"> -->
|
||||||
|
<input type="file" id="upload_file_app" lay-verify="upload_file_app" name="file_data">
|
||||||
|
</div>
|
||||||
|
<!-- <div class="layui-form-mid layui-word-aux">
|
||||||
|
<span class="x-red">*</span>将会成为您唯一的登入名
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="card_name" class="layui-form-label">
|
||||||
|
<span class="x-red"></span>卡片名称</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" id="card_name" name="card_name" required="" lay-verify="card_name" autocomplete="off" class="layui-input" value="{$result.name}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="page_url_record" class="layui-form-label">
|
||||||
|
<span class="x-red">*</span>手动记录路径</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" id="page_url_record" name="page_url_record" required="" lay-verify="page_url_record" autocomplete="off" class="layui-input" value="{$result.page_url_record}"></div>
|
||||||
|
<div class="layui-form-mid layui-word-aux"></div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="page_url_report" class="layui-form-label">
|
||||||
|
<span class="x-red">*</span>报告页路径</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" id="page_url_report" name="page_url_report" required="" lay-verify="page_url_report" autocomplete="off" class="layui-input" value="{$result.page_url_report}"></div>
|
||||||
|
<div class="layui-form-mid layui-word-aux"></div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="page_url_bluetooth" class="layui-form-label">
|
||||||
|
<span class="x-red">*</span>蓝牙路径</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" id="page_url_bluetooth" name="page_url_bluetooth" required="" lay-verify="page_url_bluetooth" autocomplete="off" class="layui-input" value="{$result.page_url_bluetooth}"></div>
|
||||||
|
<div class="layui-form-mid layui-word-aux"></div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="content" class="layui-form-label">
|
||||||
|
<span class="x-red">*</span>描述</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" id="content" name="content" required="" lay-verify="content" autocomplete="off" class="layui-input" value="{$result.content}"></div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="L_repass" class="layui-form-label"></label>
|
||||||
|
<!-- <div class="layui-btn" id="add" lay-filter="add" lay-submit="">增加</div>
|
||||||
|
<input value="登录" lay-submit lay-filter="add" type="submit" class="layui-btn"> -->
|
||||||
|
<button class="layui-btn" lay-filter="add" lay-submit="">修改</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="layui-fluid">
|
||||||
|
<div id="official_1" class="layui-row">
|
||||||
|
<div style="margin-left: 8%;margin-top: 5%;font-size: 25px;">请先下载模板文件,信息填写完成并上传该文件后点击生成</div>
|
||||||
|
<img style="width: 90%;margin-left: 3%;"src="/uploads/code_demo.png?v=1.0" alt="">
|
||||||
|
<div class="layui-form-item" style="width: 30%;margin-left: 33%;margin-top: 5%;">
|
||||||
|
<span>步骤1:</span><a href="/uploads/code_demo.xlsx" class="layui-btn" lay-filter="add">下载模板文件</a>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" style="width: 50%;margin-left: 33%;margin-top: 5%;">
|
||||||
|
<span>步骤2:</span><input type="file" id="data_excel" name="data_excel">
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" style="width: 30%;margin-left: 33%;margin-top: 5%;">
|
||||||
|
<span>步骤3:</span><button class="layui-btn" lay-filter="add" lay-submit="" onclick="add_data()">生成</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
var id = "{$result.id}"
|
||||||
|
var file_name_all = ''
|
||||||
|
var file_name = ''
|
||||||
|
var file_extension = ''
|
||||||
|
var pd = true
|
||||||
|
|
||||||
|
$('#upload_file_app').on('change', function() {
|
||||||
|
// 获取被选择的文件
|
||||||
|
var fileInput = $(this)[0];
|
||||||
|
var file = fileInput.files[0];
|
||||||
|
|
||||||
|
// 检查是否有文件被选择
|
||||||
|
if (file) {
|
||||||
|
// 获取文件的名称
|
||||||
|
file_name_all = file.name;
|
||||||
|
// 使用lastIndexOf和substring来获取文件名(不包括后缀)
|
||||||
|
var lastIndex = file_name_all.lastIndexOf('.');
|
||||||
|
file_name = lastIndex !== -1 ? file_name_all.substring(0, lastIndex) : file_name_all;
|
||||||
|
// 获取文件后缀
|
||||||
|
file_extension = lastIndex !== -1 ? file_name_all.substring(lastIndex + 1) : '';
|
||||||
|
$('#file_name').val(file_name)
|
||||||
|
// console.log($('#upload_file_app')[0].files[0])
|
||||||
|
// formdata.append('apk',$('#upload_file_app')[0].files[0])
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function edit_data(){
|
||||||
|
if(pd === false){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var formdata = new FormData();
|
||||||
|
formdata.append('upload_file_app',$('#upload_file_app')[0].files[0])
|
||||||
|
formdata.append('card_name',$('#card_name').val())
|
||||||
|
formdata.append('page_url_record',$('#page_url_record').val())
|
||||||
|
formdata.append('page_url_report',$('#page_url_report').val())
|
||||||
|
formdata.append('page_url_bluetooth',$('#page_url_bluetooth').val())
|
||||||
|
formdata.append('content',$('#content').val())
|
||||||
|
formdata.append('file_extension',file_extension)
|
||||||
|
formdata.append('id',id)
|
||||||
|
load()
|
||||||
|
pd = false
|
||||||
|
console.log('进来了')
|
||||||
|
$.ajax({
|
||||||
|
url:"/card/card_edit_action", //请求的url地址
|
||||||
|
contentType:false,
|
||||||
|
processData:false,
|
||||||
|
async:true,//请求是否异步,默认为异步,这也是ajax重要特性
|
||||||
|
data:formdata, //参数值
|
||||||
|
type:"POST", //请求方式
|
||||||
|
success:function(req){
|
||||||
|
c_load()
|
||||||
|
pd = true
|
||||||
|
if(req.code == 0){
|
||||||
|
layer.alert("修改成功", {icon: 6},function() {
|
||||||
|
//关闭当前frame
|
||||||
|
xadmin.close();
|
||||||
|
// 可以对父窗口进行刷新
|
||||||
|
xadmin.father_reload();
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
layer.alert("修改失败"+req.msg, {icon: 6},function() {
|
||||||
|
//关闭当前frame
|
||||||
|
xadmin.close();
|
||||||
|
// 可以对父窗口进行刷新
|
||||||
|
xadmin.father_reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//请求成功时处理
|
||||||
|
|
||||||
|
console.log(req)
|
||||||
|
},
|
||||||
|
error:function(){
|
||||||
|
//请求出错处理
|
||||||
|
pd = true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
layui.use(['form', 'layer','jquery'],function() {
|
||||||
|
$ = layui.jquery;
|
||||||
|
var form = layui.form,
|
||||||
|
layer = layui.layer;
|
||||||
|
|
||||||
|
//自定义验证规则
|
||||||
|
form.verify({
|
||||||
|
|
||||||
|
// upload_file_app: function(value) {
|
||||||
|
// if (value == '') {
|
||||||
|
// return '请先选择文件';
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
file_name: function(value) {
|
||||||
|
if (value == '') {
|
||||||
|
return '必须填写文件名';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// version_num: [/[\d.]{0,9}$/, '版本号必须以大写V开头最多10个字符(由数字跟英文"."组成)'],
|
||||||
|
content: function(value) {
|
||||||
|
if (value == '') {
|
||||||
|
return '必须填写描述';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(add)',function(data) {
|
||||||
|
//发异步,把数据提交给php
|
||||||
|
edit_data()
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//加载提示开启
|
||||||
|
function load() {
|
||||||
|
var index = layer.load(1, {
|
||||||
|
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 关闭加载提示
|
||||||
|
function c_load() {
|
||||||
|
layer.close(layer.index)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,288 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="x-admin-sm">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>所有卡片管理</title>
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/font.css">
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/xadmin.css">
|
||||||
|
<script src="/x_admin/lib/layui/layui.js" charset="utf-8"></script>
|
||||||
|
<script type="text/javascript" src="/x_admin/js/xadmin.js"></script>
|
||||||
|
<style>
|
||||||
|
/* th{
|
||||||
|
min-width:30px;
|
||||||
|
} */
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="x-nav">
|
||||||
|
<span class="layui-breadcrumb">
|
||||||
|
<a href="">首页</a>
|
||||||
|
<a href="">演示</a>
|
||||||
|
<a>
|
||||||
|
<cite>导航元素</cite></a>
|
||||||
|
</span>
|
||||||
|
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
|
||||||
|
<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
|
||||||
|
</div>
|
||||||
|
<div class="layui-fluid">
|
||||||
|
<div class="layui-row layui-col-space15">
|
||||||
|
<div class="layui-col-md12">
|
||||||
|
<div class="layui-card">
|
||||||
|
<!-- <div class="layui-card-body ">
|
||||||
|
<form class="layui-form layui-col-space5">
|
||||||
|
<div class="layui-inline layui-show-xs-block">
|
||||||
|
<input class="layui-input" autocomplete="off" placeholder="开始日" name="start" id="s_time">
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline layui-show-xs-block">
|
||||||
|
<input class="layui-input" autocomplete="off" placeholder="截止日" name="end" id="e_time">
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline layui-show-xs-block">
|
||||||
|
<input type="text" name="username" placeholder="请输入用户手机" autocomplete="off" class="layui-input" id="tel">
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline layui-show-xs-block">
|
||||||
|
<input type="text" name="username" placeholder="请输入用户邮箱" autocomplete="off" class="layui-input" id="email">
|
||||||
|
</div>
|
||||||
|
<div class="layui-input-inline layui-show-xs-block">
|
||||||
|
<select name="contrller" id="status_num">
|
||||||
|
<option value="">状态</option>
|
||||||
|
<option value="0">启用</option>
|
||||||
|
<option value="1">停用</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline layui-show-xs-block">
|
||||||
|
<div class="layui-btn" lay-submit="" lay-filter="sreach" onclick="find('y')"><i class="layui-icon"></i></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div> -->
|
||||||
|
<div class="layui-card-header">
|
||||||
|
<!-- <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量停用</button> -->
|
||||||
|
<!-- <button class="layui-btn" onclick="xadmin.open('添加用户','/appversion/app_add','100%','100%')"><i class="layui-icon"></i>添加</button> -->
|
||||||
|
<button class="layui-btn" onclick="xadmin.open('添加版本','/k/a/cookbook/add_cookbook','100%','100%')"><i class="layui-icon"></i>添加</button>
|
||||||
|
</div>
|
||||||
|
<div class="layui-card-body layui-table-body layui-table-main">
|
||||||
|
<table class="layui-table layui-form">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>食谱名称</th>
|
||||||
|
<th>预览图</th>
|
||||||
|
<th>创建人</th>
|
||||||
|
<th>点赞数</th>
|
||||||
|
<th>阅读数</th>
|
||||||
|
<th>创建时间</th>
|
||||||
|
<th>状态</th>
|
||||||
|
<th>操作</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id='content'>
|
||||||
|
{volist name="result" id="vo"}
|
||||||
|
<tr>
|
||||||
|
<td>{$vo.id}</td>
|
||||||
|
<td>{$vo.title}</td>
|
||||||
|
<th><img style="height: 100px;" src="{$vo.pic_url}" alt=""></th>
|
||||||
|
<td>{$vo.create_user_nickname}</td>
|
||||||
|
<td>{$vo.likes_num}</td>
|
||||||
|
<td>{$vo.read_it}</td>
|
||||||
|
<td>{$vo.create_time}</td>
|
||||||
|
<td class="td-status">
|
||||||
|
{if condition="$vo.is_del == 1"}
|
||||||
|
<span onclick="app_stop(this,'{$vo.id}')" class="layui-btn layui-btn-normal layui-btn-mini layui-btn-disabled" title="停用">已停用</span>
|
||||||
|
{else /}
|
||||||
|
<span onclick="app_stop(this,'{$vo.id}')" class="layui-btn layui-btn-normal layui-btn-mini" title="启用">已启用</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<!-- <button class="layui-btn" onclick="xadmin.open('修改','/card/card_edit?id={$vo.id}','80%','60%')">修改</button> -->
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="layui-card-body ">
|
||||||
|
<div id="page" style="text-align: center;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
var form
|
||||||
|
layui.use(['laydate','form'], function(){
|
||||||
|
var laydate = layui.laydate;
|
||||||
|
form = layui.form;
|
||||||
|
});
|
||||||
|
var page_num;
|
||||||
|
var laypage;
|
||||||
|
var all_page = "{$num}";
|
||||||
|
layui.use('laypage', function () {
|
||||||
|
laypage = layui.laypage;
|
||||||
|
//执行一个laypage实例
|
||||||
|
laypage.render({
|
||||||
|
elem: 'page',
|
||||||
|
count: all_page, //数据总数,从服务端得到
|
||||||
|
limit: 15,
|
||||||
|
groups:5, //显示几个分页按钮
|
||||||
|
jump: function (obj, first) {
|
||||||
|
//首次不执行
|
||||||
|
if (!first) {
|
||||||
|
//obj包含了当前分页的所有参数,比如:
|
||||||
|
console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
|
||||||
|
console.log(obj.limit); //得到每页显示的条数
|
||||||
|
page_num = obj.curr;
|
||||||
|
find("n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/*用户-停用*/
|
||||||
|
function app_stop(obj,id){
|
||||||
|
|
||||||
|
// return
|
||||||
|
var title = '',status,num
|
||||||
|
if($(obj).attr('title')=='启用'){
|
||||||
|
title = '停用'
|
||||||
|
status = 1
|
||||||
|
num = 5
|
||||||
|
}else{
|
||||||
|
title = '启用'
|
||||||
|
status = 0
|
||||||
|
num = 6
|
||||||
|
}
|
||||||
|
// console.log('点击时'+$(obj).attr('title')+'====='+id+'===传到后台是否删除:'+is_del)
|
||||||
|
layer.confirm('确认要'+ title +'吗?',function(index){
|
||||||
|
load()
|
||||||
|
$.ajax({
|
||||||
|
url:"/k/a/cookbook/stop_and_run", //请求的url地址
|
||||||
|
dataType:"json", //返回格式为json
|
||||||
|
async:true,//请求是否异步,默认为异步,这也是ajax重要特性
|
||||||
|
data:{"id":id,'status':status}, //参数值
|
||||||
|
type:"POST", //请求方式
|
||||||
|
success:function(req){
|
||||||
|
c_load()
|
||||||
|
//请求成功时处理
|
||||||
|
if(req['code'] == 0){
|
||||||
|
//发异步把用户状态进行更改
|
||||||
|
$(obj).attr('title',title)
|
||||||
|
if(status == 1){
|
||||||
|
$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已'+ title);
|
||||||
|
}else{
|
||||||
|
$(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已'+ title);
|
||||||
|
}
|
||||||
|
layer.msg('已'+ title,{icon: num});
|
||||||
|
}else{
|
||||||
|
layer.msg('操作失败!',{icon: 5});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error:function(){
|
||||||
|
//请求出错处理
|
||||||
|
}});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function find(pd) {
|
||||||
|
if(!page_num || pd == 'y'){
|
||||||
|
page_num = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
page({
|
||||||
|
"status_num":$('#status_num').val(),
|
||||||
|
"tel":$('#tel').val(),
|
||||||
|
"email":$('#email').val(),
|
||||||
|
"s_time":$('#s_time').val(),
|
||||||
|
"e_time":$('#e_time').val(),
|
||||||
|
"page_num":page_num,
|
||||||
|
"tt":1},pd);
|
||||||
|
}
|
||||||
|
function page(data,pd) {
|
||||||
|
console.log(data)
|
||||||
|
load()
|
||||||
|
$.ajax({
|
||||||
|
url: "/k/a/cookbook/index", //请求的url地址s
|
||||||
|
dataType: "json", //返回格式为json
|
||||||
|
async: true,//请求是否异步,默认为异步,这也是ajax重要特性
|
||||||
|
data: data, //参数值
|
||||||
|
type: "POST", //请求方式
|
||||||
|
success: function (req) {
|
||||||
|
console.log(req)
|
||||||
|
c_load();
|
||||||
|
if (req['code'] == 0) {
|
||||||
|
|
||||||
|
var str,str_s,str_c,str_all="";
|
||||||
|
|
||||||
|
for (let i = 0; i < req['data']['data'].length; i++) {
|
||||||
|
if(req['data']['data'][i]['is_del'] == 1){
|
||||||
|
str = '<span onclick="app_stop(this,\''+req['data']['data'][i]['id']+'\')" class="layui-btn layui-btn-normal layui-btn-mini layui-btn-disabled" title="停用">已停用</span>'
|
||||||
|
}else{
|
||||||
|
str = '<span onclick="app_stop(this,\''+ req['data']['data'][i]['id'] +'\')" class="layui-btn layui-btn-normal layui-btn-mini" title="启用">已启用</span>'
|
||||||
|
}
|
||||||
|
str_c = '<tr>'+
|
||||||
|
'<td>'+req['data']['data'][i]['id']+'</td>'+
|
||||||
|
'<td>'+req['data']['data'][i]['title']+'</td>'+
|
||||||
|
'<td><img style="height: 100px;" src="'+req['data']['data'][i]['pic_url']+'" alt=""></td>'+
|
||||||
|
'<td>'+req['data']['data'][i]['create_user_nickname']+'</td>'+
|
||||||
|
'<td>'+req['data']['data'][i]['likes_num']+'</td>'+
|
||||||
|
'<td>'+req['data']['data'][i]['read_it']+'</td>'+
|
||||||
|
'<td>'+req['data']['data'][i]['create_time']+'</td>'+
|
||||||
|
'<td class="td-status">'+
|
||||||
|
str+
|
||||||
|
'</td>'+
|
||||||
|
// '<td>'+
|
||||||
|
// '<button class="layui-btn" onclick="xadmin.open(\'修改\',\'/card/card_edit?id={$vo.id}\',\'80%\',\'60%\')">修改</button>'+
|
||||||
|
// '</td>'+
|
||||||
|
'</tr>'
|
||||||
|
str_all = str_all+str_c;
|
||||||
|
}
|
||||||
|
console.log(str_all)
|
||||||
|
$('#content').html(str_all);
|
||||||
|
|
||||||
|
form.render();
|
||||||
|
if(pd == 'y'){
|
||||||
|
$("#page").html("")
|
||||||
|
laypage.render({
|
||||||
|
elem: 'page',
|
||||||
|
count: req['data']['num'], //数据总数,从服务端得到
|
||||||
|
limit: 10,
|
||||||
|
groups:10,
|
||||||
|
jump: function (obj, first) {
|
||||||
|
//首次不执行
|
||||||
|
if (!first) {
|
||||||
|
//obj包含了当前分页的所有参数,比如:
|
||||||
|
console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
|
||||||
|
console.log(obj.limit); //得到每页显示的条数
|
||||||
|
page_num = obj.curr;
|
||||||
|
// page({"page":page_num,"tt":1});
|
||||||
|
find("n")
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.msg(req['msg'])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
//请求出错处理
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//加载提示开启
|
||||||
|
function load() {
|
||||||
|
var index = layer.load(1, {
|
||||||
|
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 关闭加载提示
|
||||||
|
function c_load() {
|
||||||
|
layer.close(layer.index)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,230 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html class="x-admin-sm">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>后台登录-X-admin2.2</title>
|
||||||
|
<meta name="renderer" content="webkit|ie-comp|ie-stand">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||||
|
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/font.css">
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/xadmin.css">
|
||||||
|
<!-- <link rel="stylesheet" href="./css/theme5.css"> -->
|
||||||
|
<script src="/x_admin/lib/layui/layui.js" charset="utf-8"></script>
|
||||||
|
<script type="text/javascript" src="/x_admin/js/xadmin.js"></script>
|
||||||
|
<script>
|
||||||
|
// 是否开启刷新记忆tab功能
|
||||||
|
// var is_remember = false;
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body class="index">
|
||||||
|
<!-- 顶部开始 -->
|
||||||
|
<div class="container">
|
||||||
|
<div class="logo">
|
||||||
|
<a href="./index.html">X-admin v2.2</a></div>
|
||||||
|
<div class="left_open">
|
||||||
|
<a><i title="展开左侧栏" class="iconfont"></i></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="layui-nav right" lay-filter="">
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a href="javascript:;">admin</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<!-- 二级菜单 -->
|
||||||
|
<dd>
|
||||||
|
<a onclick="xadmin.open('切换帐号','http://www.baidu.com')">切换帐号</a></dd>
|
||||||
|
<dd>
|
||||||
|
<a href="./login.html">退出</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!-- 顶部结束 -->
|
||||||
|
<!-- 中部开始 -->
|
||||||
|
<!-- 左侧菜单开始 -->
|
||||||
|
<div class="left-nav">
|
||||||
|
<div id="side-nav">
|
||||||
|
<ul id="nav">
|
||||||
|
<li>
|
||||||
|
<a href="javascript:;">
|
||||||
|
<i class="iconfont left-nav-li" lay-tips="食谱管理"></i>
|
||||||
|
<cite>食谱管理</cite>
|
||||||
|
<i class="iconfont nav_right"></i></a>
|
||||||
|
<ul class="sub-menu">
|
||||||
|
<li>
|
||||||
|
<a onclick="xadmin.add_tab('食谱列表','/k/a/cookbook/index')">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>食谱列表</cite></a>
|
||||||
|
</li>
|
||||||
|
<!-- <li>
|
||||||
|
<a onclick="xadmin.add_tab('APP角色数据列表','/member/user_list')">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>APP角色数据列表</cite></a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a onclick="xadmin.add_tab('APP角色数据列表','/member/user_list')">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>角色使用记录查询</cite></a>
|
||||||
|
</li> -->
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<!-- <li>
|
||||||
|
<a href="javascript:;">
|
||||||
|
<i class="iconfont left-nav-li" lay-tips="卡片管理"></i>
|
||||||
|
<cite>卡片管理</cite>
|
||||||
|
<i class="iconfont nav_right"></i></a>
|
||||||
|
<ul class="sub-menu">
|
||||||
|
<li>
|
||||||
|
<a onclick="xadmin.add_tab('所有卡片管理','/card/index')">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>所有卡片管理</cite></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="javascript:;">
|
||||||
|
<i class="iconfont left-nav-li" lay-tips="设备管理"></i>
|
||||||
|
<cite>设备管理</cite>
|
||||||
|
<i class="iconfont nav_right"></i></a>
|
||||||
|
<ul class="sub-menu">
|
||||||
|
<li>
|
||||||
|
<a onclick="xadmin.add_tab('所有设备管理','/device/index')">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>设备管理</cite></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="javascript:;">
|
||||||
|
<i class="iconfont left-nav-li" lay-tips="估分功能管理"></i>
|
||||||
|
<cite>估分功能管理</cite>
|
||||||
|
<i class="iconfont nav_right"></i></a>
|
||||||
|
<ul class="sub-menu">
|
||||||
|
<li>
|
||||||
|
<a onclick="xadmin.add_tab('地市规则列表','/estimate/index')">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>地市规则列表</cite></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="javascript:;">
|
||||||
|
<i class="iconfont left-nav-li" lay-tips="APP版本管理"></i>
|
||||||
|
<cite>APP版本管理</cite>
|
||||||
|
<i class="iconfont nav_right"></i></a>
|
||||||
|
<ul class="sub-menu">
|
||||||
|
<li>
|
||||||
|
<a onclick="xadmin.add_tab('APP版本管理','/appversion/index')">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>APP版本管理</cite></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="javascript:;">
|
||||||
|
<i class="iconfont left-nav-li" lay-tips="资讯管理"></i>
|
||||||
|
<cite>资讯管理</cite>
|
||||||
|
<i class="iconfont nav_right"></i></a>
|
||||||
|
<ul class="sub-menu">
|
||||||
|
<li>
|
||||||
|
<a onclick="xadmin.add_tab('资讯推荐栏管理','/editortext/index')">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>资讯推荐栏管理</cite></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="javascript:;">
|
||||||
|
<i class="iconfont left-nav-li" lay-tips="Banner图&公告管理"></i>
|
||||||
|
<cite>Banner图&公告&弹窗</cite>
|
||||||
|
<i class="iconfont nav_right"></i></a>
|
||||||
|
<ul class="sub-menu">
|
||||||
|
<li>
|
||||||
|
<a onclick="xadmin.add_tab('操作管理','/notice/banner_index')">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>操作管理</cite></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="javascript:;">
|
||||||
|
<i class="iconfont left-nav-li" lay-tips="商业合作"></i>
|
||||||
|
<cite>商业合作</cite>
|
||||||
|
<i class="iconfont nav_right"></i></a>
|
||||||
|
<ul class="sub-menu">
|
||||||
|
<li>
|
||||||
|
<a onclick="xadmin.add_tab('操作管理','/business/business_index')">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>操作管理</cite></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="javascript:;">
|
||||||
|
<i class="iconfont left-nav-li" lay-tips="厨房秤"></i>
|
||||||
|
<cite>厨房秤</cite>
|
||||||
|
<i class="iconfont nav_right"></i></a>
|
||||||
|
<ul class="sub-menu">
|
||||||
|
<li>
|
||||||
|
<a href="javascript:;">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>食材管理</cite>
|
||||||
|
<i class="iconfont nav_right"></i></a>
|
||||||
|
<ul class="sub-menu">
|
||||||
|
<li>
|
||||||
|
<a onclick="xadmin.add_tab('食材列表','/kitchenscale/food_ingredients_index_1')">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>食材列表</cite></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="sub-menu">
|
||||||
|
<li>
|
||||||
|
<a href="javascript:;">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>菜谱管理</cite>
|
||||||
|
<i class="iconfont nav_right"></i></a>
|
||||||
|
<ul class="sub-menu">
|
||||||
|
<li>
|
||||||
|
<a onclick="xadmin.add_tab('菜谱列表','member-del.html')">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<cite>菜谱列表</cite></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li> -->
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="x-slide_left"></div> -->
|
||||||
|
<!-- 左侧菜单结束 -->
|
||||||
|
<!-- 右侧主体开始 -->
|
||||||
|
<div class="page-content">
|
||||||
|
<div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">
|
||||||
|
<ul class="layui-tab-title">
|
||||||
|
<li class="home">
|
||||||
|
<i class="layui-icon"></i>我的桌面</li></ul>
|
||||||
|
<div class="layui-unselect layui-form-select layui-form-selected" id="tab_right">
|
||||||
|
<dl>
|
||||||
|
<dd data-type="this">关闭当前</dd>
|
||||||
|
<dd data-type="other">关闭其它</dd>
|
||||||
|
<dd data-type="all">关闭全部</dd></dl>
|
||||||
|
</div>
|
||||||
|
<div class="layui-tab-content">
|
||||||
|
<div class="layui-tab-item layui-show">
|
||||||
|
<iframe src='/admin/welcome' frameborder="0" scrolling="yes" class="x-iframe"></iframe>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="tab_show"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="page-content-bg"></div>
|
||||||
|
<style id="theme_style"></style>
|
||||||
|
<!-- 右侧主体结束 -->
|
||||||
|
<!-- 中部结束 -->
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,219 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="x-admin-sm">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>欢迎页面-X-admin2.2</title>
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/font.css">
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/xadmin.css">
|
||||||
|
<script src="/x_admin/lib/layui/layui.js" charset="utf-8"></script>
|
||||||
|
<script type="text/javascript" src="/x_admin/js/xadmin.js"></script>
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
||||||
|
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layui-fluid">
|
||||||
|
<div class="layui-row layui-col-space15">
|
||||||
|
|
||||||
|
<div class="layui-col-sm12 layui-col-md6">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-header">最新一周新增用户</div>
|
||||||
|
<div class="layui-card-body" style="min-height: 280px;">
|
||||||
|
<div id="main1" class="layui-col-sm12" style="height: 300px;"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-sm12 layui-col-md6">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-header">最新一周PV/UV量</div>
|
||||||
|
<div class="layui-card-body" style="min-height: 280px;">
|
||||||
|
<div id="main2" class="layui-col-sm12" style="height: 300px;"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-sm12 layui-col-md6">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-header">用户来源</div>
|
||||||
|
<div class="layui-card-body" style="min-height: 280px;">
|
||||||
|
<div id="main3" class="layui-col-sm12" style="height: 300px;"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-sm12 layui-col-md6">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-header">硬盘使用量</div>
|
||||||
|
<div class="layui-card-body" style="min-height: 280px;">
|
||||||
|
<div id="main4" class="layui-col-sm12" style="height: 300px;"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.bootcss.com/echarts/4.2.1-rc1/echarts.min.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
// 基于准备好的dom,初始化echarts实例
|
||||||
|
var myChart = echarts.init(document.getElementById('main1'));
|
||||||
|
|
||||||
|
// 指定图表的配置项和数据
|
||||||
|
var option = {
|
||||||
|
grid: {
|
||||||
|
top: '5%',
|
||||||
|
right: '1%',
|
||||||
|
left: '1%',
|
||||||
|
bottom: '10%',
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis'
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: ['周一','周二','周三','周四','周五','周六','周日']
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value'
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name:'用户量',
|
||||||
|
data: [820, 932, 901, 934, 1290, 1330, 1320],
|
||||||
|
type: 'line',
|
||||||
|
smooth: true
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 使用刚指定的配置项和数据显示图表。
|
||||||
|
myChart.setOption(option);
|
||||||
|
|
||||||
|
// 基于准备好的dom,初始化echarts实例
|
||||||
|
var myChart = echarts.init(document.getElementById('main2'));
|
||||||
|
|
||||||
|
// 指定图表的配置项和数据
|
||||||
|
var option = {
|
||||||
|
tooltip : {
|
||||||
|
trigger: 'axis',
|
||||||
|
axisPointer: {
|
||||||
|
type: 'cross',
|
||||||
|
label: {
|
||||||
|
backgroundColor: '#6a7985'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
top: '5%',
|
||||||
|
right: '2%',
|
||||||
|
left: '1%',
|
||||||
|
bottom: '10%',
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
xAxis : [
|
||||||
|
{
|
||||||
|
type : 'category',
|
||||||
|
boundaryGap : false,
|
||||||
|
data : ['周一','周二','周三','周四','周五','周六','周日']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
yAxis : [
|
||||||
|
{
|
||||||
|
type : 'value'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series : [
|
||||||
|
{
|
||||||
|
name:'PV',
|
||||||
|
type:'line',
|
||||||
|
areaStyle: {normal: {}},
|
||||||
|
data:[120, 132, 101, 134, 90, 230, 210],
|
||||||
|
smooth: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name:'UV',
|
||||||
|
type:'line',
|
||||||
|
areaStyle: {normal: {}},
|
||||||
|
data:[45, 182, 191, 234, 290, 330, 310],
|
||||||
|
smooth: true,
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 使用刚指定的配置项和数据显示图表。
|
||||||
|
myChart.setOption(option);
|
||||||
|
|
||||||
|
|
||||||
|
// 基于准备好的dom,初始化echarts实例
|
||||||
|
var myChart = echarts.init(document.getElementById('main3'));
|
||||||
|
|
||||||
|
// 指定图表的配置项和数据
|
||||||
|
var option = {
|
||||||
|
tooltip : {
|
||||||
|
trigger: 'item',
|
||||||
|
formatter: "{a} <br/>{b} : {c} ({d}%)"
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
orient: 'vertical',
|
||||||
|
left: 'left',
|
||||||
|
data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
|
||||||
|
},
|
||||||
|
series : [
|
||||||
|
{
|
||||||
|
name: '访问来源',
|
||||||
|
type: 'pie',
|
||||||
|
radius : '55%',
|
||||||
|
center: ['50%', '60%'],
|
||||||
|
data:[
|
||||||
|
{value:335, name:'直接访问'},
|
||||||
|
{value:310, name:'邮件营销'},
|
||||||
|
{value:234, name:'联盟广告'},
|
||||||
|
{value:135, name:'视频广告'},
|
||||||
|
{value:1548, name:'搜索引擎'}
|
||||||
|
],
|
||||||
|
itemStyle: {
|
||||||
|
emphasis: {
|
||||||
|
shadowBlur: 10,
|
||||||
|
shadowOffsetX: 0,
|
||||||
|
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 使用刚指定的配置项和数据显示图表。
|
||||||
|
myChart.setOption(option);
|
||||||
|
|
||||||
|
// 基于准备好的dom,初始化echarts实例
|
||||||
|
var myChart = echarts.init(document.getElementById('main4'));
|
||||||
|
|
||||||
|
// 指定图表的配置项和数据
|
||||||
|
var option = {
|
||||||
|
tooltip : {
|
||||||
|
formatter: "{a} <br/>{b} : {c}%"
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '硬盘使用量',
|
||||||
|
type: 'gauge',
|
||||||
|
detail: {formatter:'{value}%'},
|
||||||
|
data: [{value: 88, name: '已使用'}]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
// 使用刚指定的配置项和数据显示图表。
|
||||||
|
myChart.setOption(option);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html class="x-admin-sm">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>后台登录-X-admin2.2</title>
|
||||||
|
<meta name="renderer" content="webkit|ie-comp|ie-stand">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||||
|
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/font.css">
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/login.css">
|
||||||
|
<link rel="stylesheet" href="/x_admin/css/xadmin.css">
|
||||||
|
<script type="text/javascript" src="/x_admin/js/jq.js"></script>
|
||||||
|
<script src="/x_admin/lib/layui/layui.js" charset="utf-8"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="login-bg">
|
||||||
|
|
||||||
|
<div class="login layui-anim layui-anim-up">
|
||||||
|
<div class="message">轻厨记管理后台</div>
|
||||||
|
<div id="darkbannerwrap"></div>
|
||||||
|
<form method="post" class="layui-form" >
|
||||||
|
<input name="username" placeholder="用户名" type="text" lay-verify="required" class="layui-input" >
|
||||||
|
<hr class="hr15">
|
||||||
|
<input name="password" lay-verify="required" placeholder="密码" type="password" class="layui-input">
|
||||||
|
<hr class="hr15">
|
||||||
|
<input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
|
||||||
|
<hr class="hr20" >
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
var pd = true
|
||||||
|
layui.use('form', function(){
|
||||||
|
var form = layui.form;
|
||||||
|
// layer.msg('玩命卖萌中', function(){
|
||||||
|
// //关闭后的操作
|
||||||
|
// });
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(login)', function(data){
|
||||||
|
if(pd){
|
||||||
|
pd = false
|
||||||
|
console.log('进来了')
|
||||||
|
$.ajax({
|
||||||
|
url:"/k/a/login_action", //请求的url地址
|
||||||
|
dataType:"json", //返回格式为json
|
||||||
|
async:true,//请求是否异步,默认为异步,这也是ajax重要特性
|
||||||
|
data:{"username":data.field.username,"password":data.field.password}, //参数值
|
||||||
|
type:"POST", //请求方式
|
||||||
|
success:function(req){
|
||||||
|
//请求成功时处理
|
||||||
|
|
||||||
|
if(req.code == 0){
|
||||||
|
layer.msg('登录成功,准备跳转',function(){
|
||||||
|
location.href='/k/a/index'
|
||||||
|
},200);
|
||||||
|
}else{
|
||||||
|
layer.msg('登录失败',function(){
|
||||||
|
pd = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error:function(){
|
||||||
|
//请求出错处理
|
||||||
|
pd = true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<!-- 底部结束 -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="pic_box_upload" onclick="upload_action()"><img src="/tsf/upload_pic.jpg" alt=""></div>
|
<div class="pic_box_upload" onclick="upload_action()"><img src="https://tc.pcxbc.com/tsf/upload_pic.jpg" alt=""></div>
|
||||||
{volist name="result" id="vo"}
|
{volist name="result" id="vo"}
|
||||||
<div class="pic_box" onclick="sendParamToParent('{$vo.id}','{$vo.url_data}')"><img src="{$vo.url_data}" alt=""></div>
|
<div class="pic_box" onclick="sendParamToParent('{$vo.id}','{$vo.url_data}')"><img src="{$vo.url_data}" alt=""></div>
|
||||||
{/volist}
|
{/volist}
|
||||||
|
|
|
||||||
|
|
@ -430,10 +430,10 @@ class Login extends Base{
|
||||||
$num = mt_rand(100000,999999);
|
$num = mt_rand(100000,999999);
|
||||||
if (preg_match('/^\d{11}$/', $data['data'])) {
|
if (preg_match('/^\d{11}$/', $data['data'])) {
|
||||||
// 本公司短信
|
// 本公司短信
|
||||||
$result = $this->send_tel_code($data['data'],$num);
|
// $result = $this->send_tel_code($data['data'],$num);
|
||||||
// 阿里云短信
|
// 阿里云短信
|
||||||
// $sms_all = new Smsaliyun;
|
$sms_all = new Smsaliyun;
|
||||||
// $result = $sms_all->send_sms($data['data'],$num);
|
$result = $sms_all->send_sms($data['data'],$num);
|
||||||
// dump($result);
|
// dump($result);
|
||||||
$road = 'tel';
|
$road = 'tel';
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
|
|
@ -14,16 +14,67 @@ class Smsaliyun extends Controller
|
||||||
'accessKeyId' => 'LTAI5tQCdWe9Epir3ydXWbzp',
|
'accessKeyId' => 'LTAI5tQCdWe9Epir3ydXWbzp',
|
||||||
'accessKeySecret' => 'JKLzF0b5AXw2ajhwtem2fhPSUZVOZ5',
|
'accessKeySecret' => 'JKLzF0b5AXw2ajhwtem2fhPSUZVOZ5',
|
||||||
'signName' => '郑州巨天信息',
|
'signName' => '郑州巨天信息',
|
||||||
'templateCode' => 'SMS_484085215',
|
// 'signName' => '郑州品传科技',
|
||||||
|
// 'templateCode' => 'SMS_484085215',//reedaw模板 :您好,欢迎使用Reedaw,您的手机验证码是: ${code},验证码一分钟内有效,若非本人操作,请忽略本短信
|
||||||
|
'templateCode' => 'SMS_491550200',//巨天通用模板 :您好,您的手机验证码是: ${code},请尽快输入避免验证码失效,若非本人操作,请忽略本短信
|
||||||
|
// 'templateCode' => 'SMS_491320295',//品传通用模板 :您好,您的手机验证码是: ${code},请尽快输入避免验证码失效,若非本人操作,请忽略本短信
|
||||||
'regionId' => 'cn-hangzhou'
|
'regionId' => 'cn-hangzhou'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public function send_sms_api(){
|
||||||
|
$data = input();
|
||||||
|
if(!array_key_exists('tel',$data)){
|
||||||
|
return json([
|
||||||
|
'code'=>10001,
|
||||||
|
'msg'=>'缺少手机号码',
|
||||||
|
'data'=>[],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if(!array_key_exists('code',$data)){
|
||||||
|
return json([
|
||||||
|
'code'=>10002,
|
||||||
|
'msg'=>'缺少验证码',
|
||||||
|
'data'=>[],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if(!$this->validatePhoneNumber($data['tel'])){
|
||||||
|
return json([
|
||||||
|
'code'=>10001,
|
||||||
|
'msg'=>'手机号码格式错误',
|
||||||
|
'data'=>[],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if(!$this->validateSixDigitCode($data['code'])){
|
||||||
|
return json([
|
||||||
|
'code'=>10002,
|
||||||
|
'msg'=>'验证码格式错误',
|
||||||
|
'data'=>[],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->send_sms($data['tel'],$data['code']);
|
||||||
|
|
||||||
|
return json($result);
|
||||||
|
}
|
||||||
|
// 验证函数定义(可以放在单独的文件中)
|
||||||
|
public function validatePhoneNumber($phone) {
|
||||||
|
$pattern = '/^1[3-9]\d{9}$/';
|
||||||
|
return preg_match($pattern, $phone) === 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function validateSixDigitCode($code) {
|
||||||
|
$pattern = '/^\d{6}$/';
|
||||||
|
return preg_match($pattern, $code) === 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送短信接口
|
* 发送短信接口
|
||||||
* @param string $phone 手机号
|
* @param string $phone 手机号
|
||||||
* @param string $code 验证码
|
* @param string $code 验证码
|
||||||
*/
|
*/
|
||||||
public function send_sms($phone='18530934717', $code='0932')
|
public function send_sms($phone, $code)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// 初始化阿里云客户端
|
// 初始化阿里云客户端
|
||||||
|
|
@ -53,7 +104,7 @@ class Smsaliyun extends Controller
|
||||||
->request();
|
->request();
|
||||||
|
|
||||||
$result = $result->toArray();
|
$result = $result->toArray();
|
||||||
|
// return $result;
|
||||||
if ($result['Code'] == 'OK') {
|
if ($result['Code'] == 'OK') {
|
||||||
return [
|
return [
|
||||||
'code' => 0,
|
'code' => 0,
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
window.location.href = 'weixin://dl/business/?appid=wx9c0b7a436ada6d1e&path=pages/home/home';
|
window.location.href = 'weixin://dl/business/?appid=wx1f32af4f93c913f6&path=pages/index/index';
|
||||||
|
// window.location.href = 'https://mp.weixin.qq.com/a/~hlVtiIugLJKBe4bZVEVfAA~~';
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,10 @@ Route::any('/kitchen_qrcode', 'code/qrcode/kitchen_qrcode');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Route::post('/send_sms_api', 'app/smsaliyun/send_sms_api');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -450,6 +454,7 @@ Route::any('/open_wechat_content', 'app/Msginformation/open_wechat_content');
|
||||||
################################################################下面是厨房秤################################################################
|
################################################################下面是厨房秤################################################################
|
||||||
###########################################################################################################################################
|
###########################################################################################################################################
|
||||||
|
|
||||||
|
#########################################################前端接口############################################################
|
||||||
// 微信小程序快捷登录接口
|
// 微信小程序快捷登录接口
|
||||||
Route::any('/kitchenscale/wechat_quick_login', 'app/kitchenscale/app.index/wechat_quick_login');
|
Route::any('/kitchenscale/wechat_quick_login', 'app/kitchenscale/app.index/wechat_quick_login');
|
||||||
Route::any('/testedition/kitchenscale/wechat_quick_login', 'app/kitchenscale/app.index/wechat_quick_login');
|
Route::any('/testedition/kitchenscale/wechat_quick_login', 'app/kitchenscale/app.index/wechat_quick_login');
|
||||||
|
|
@ -571,6 +576,25 @@ Route::any('/kitchenscale/get_default_configuration', 'app/kitchenscale/app.prod
|
||||||
// Route::any('/kitchenscale/getRelatedConfigurations', 'app/kitchenscale/app.product/getRelatedConfigurations');
|
// Route::any('/kitchenscale/getRelatedConfigurations', 'app/kitchenscale/app.product/getRelatedConfigurations');
|
||||||
// Route::any('/kitchenscale/getOptionConfigurations', 'app/kitchenscale/app.product/getOptionConfigurations');
|
// Route::any('/kitchenscale/getOptionConfigurations', 'app/kitchenscale/app.product/getOptionConfigurations');
|
||||||
|
|
||||||
|
#########################################################管理后台############################################################
|
||||||
|
|
||||||
|
// 图片选择上传
|
||||||
|
Route::any('/k/admin/pic', 'app/kitchenscale/admin.base/pic_index');
|
||||||
|
Route::any('/k/admin/pic_upload_action', 'app/kitchenscale/admin.base/pic_upload_action');
|
||||||
|
|
||||||
|
// 登录页
|
||||||
|
Route::any('/k/a/login', 'app/kitchenscale/admin.login/login');
|
||||||
|
Route::any('/k/a/login_action', 'app/kitchenscale/admin.login/login_action');
|
||||||
|
// 首页
|
||||||
|
Route::any('/k/a/index', 'app/kitchenscale/admin.index/index');
|
||||||
|
Route::any('/k/a/welcome', 'app/kitchenscale/admin.index/welcome');
|
||||||
|
// 食谱页
|
||||||
|
Route::any('/k/a/cookbook/index', 'app/kitchenscale/admin.cookbook/index');
|
||||||
|
Route::any('/k/a/cookbook/add_cookbook', 'app/kitchenscale/admin.cookbook/add_cookbook');
|
||||||
|
Route::any('/k/a/cookbook/add_cookbook_action', 'app/kitchenscale/admin.cookbook/add_cookbook_action');
|
||||||
|
Route::any('/k/a/cookbook/find_food_list', 'app/kitchenscale/admin.cookbook/find_food_list');
|
||||||
|
Route::any('/k/a/cookbook/stop_and_run', 'app/kitchenscale/admin.cookbook/stop_and_run');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ use think\Log;
|
||||||
use \think\Validate;
|
use \think\Validate;
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
|
use app\app\controller\Smsaliyun;
|
||||||
|
|
||||||
class Testuse extends Controller{
|
class Testuse extends Controller{
|
||||||
|
|
||||||
|
|
@ -687,90 +688,120 @@ class Testuse extends Controller{
|
||||||
|
|
||||||
public function caipu_shuju_chuli()
|
public function caipu_shuju_chuli()
|
||||||
{
|
{
|
||||||
|
// // 处理图片,查看本地文件,数据存到图片表,修改原始数据的状态start#######################################################################
|
||||||
|
// // 初始化SQL Server数据库连接
|
||||||
|
// $cfc = Db::connect('cfc_db');
|
||||||
|
// // 查询需要处理的原始数据
|
||||||
|
// $yuanshi_data = $cfc->table('linshi_caidan_biao')
|
||||||
|
// ->where(['pic_clean' => 1,'is_move_ok'=>0])
|
||||||
|
// ->page("1,100")
|
||||||
|
// ->field('id,pic_url,name,yuanshi_id,category,pic_clean')
|
||||||
|
// ->select();
|
||||||
|
// // dump($yuanshi_data);
|
||||||
|
// // die;
|
||||||
|
// if(count($yuanshi_data) <= 0){
|
||||||
|
// return $this->msg(99999,'ok',[]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $yuanshi_mulu = 'D:\phpstudy_pro\WWW\reedaw\SchoolPhysicalExamination\public\kitchenscale_all\cook_img';
|
||||||
|
// $new_mulu = 'D:\phpstudy_pro\WWW\reedaw\SchoolPhysicalExamination\public\kitchenscale_all\cook_img\linshi';
|
||||||
|
|
||||||
|
|
||||||
|
// $result = [
|
||||||
|
// 'all'=>count($yuanshi_data),
|
||||||
|
// 'ok'=>0,
|
||||||
|
// 'no'=>0,
|
||||||
|
// 'none'=>0,
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// $temporary_arr_data = [];
|
||||||
|
// $temporary_arr_ok = [];
|
||||||
|
// $temporary_arr_none = [];
|
||||||
|
// foreach ($yuanshi_data as $key => $value) {
|
||||||
|
|
||||||
|
// // 先判断是不是个有效的图片名字
|
||||||
|
// if (preg_match('/\.jpg$/i', $value['pic_url'])) {
|
||||||
|
// // 是
|
||||||
|
// // 判断目录下是否有这个文件
|
||||||
|
// if (!file_exists($yuanshi_mulu.DS.$value['pic_url'])) {
|
||||||
|
// $result['none'] = $result['none']+1;
|
||||||
|
// array_push($temporary_arr_none,$value['yuanshi_id']);
|
||||||
|
// continue;
|
||||||
|
// }else{
|
||||||
|
// $result['ok'] = $result['ok']+1;
|
||||||
|
// array_push($temporary_arr_ok,$value['yuanshi_id']);
|
||||||
|
// array_push($temporary_arr_data,[
|
||||||
|
// 'user_token' => 'caadd1be045a65f30b92aa805f1de54a',
|
||||||
|
// 'pic_name' => $value['pic_url'],
|
||||||
|
// 'pic_url' => "https://tc.pcxbc.com/kitchenscale_all/cook_img/".$value['pic_url'],
|
||||||
|
// 'create_time' => date('Y-m-d H:i:s'),
|
||||||
|
// 'special_record_str' => $value['yuanshi_id']
|
||||||
|
// ]);
|
||||||
|
// rename($yuanshi_mulu.DS.$value['pic_url'], $new_mulu.DS.$value['pic_url']);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// $result['none'] = $result['none']+1;
|
||||||
|
// array_push($temporary_arr_none,$value['yuanshi_id']);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// // 启动事务
|
||||||
|
// $cfc->startTrans();
|
||||||
|
// try {
|
||||||
|
|
||||||
|
// if($result['ok'] > 0){
|
||||||
|
// $cfc->table('app_user_upload_img')->insertAll($temporary_arr_data);
|
||||||
|
// $cfc->table('linshi_caidan_biao')->where("yuanshi_id in ('".implode("','",$temporary_arr_ok)."')")->update(['is_move_ok'=>1]);
|
||||||
|
// }
|
||||||
|
// if($result['none'] > 0){
|
||||||
|
// $cfc->table('linshi_caidan_biao')->where("yuanshi_id in ('".implode("','",$temporary_arr_none)."')")->update(['is_move_ok'=>2]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $cfc->commit();
|
||||||
|
// return json(['code'=>0,'msg'=>'成功','data'=>$result]);
|
||||||
|
// } catch (\Exception $e) {
|
||||||
|
// $cfc->rollback();
|
||||||
|
// return json(['code'=>99999,'msg'=>'成功','data'=>[]]);
|
||||||
|
// }
|
||||||
|
// // 处理图片,查看本地文件,数据存到图片表,修改原始数据的状态end#######################################################################
|
||||||
|
|
||||||
|
//更新菜谱的图片数据为图片表的数据start#########################################
|
||||||
|
|
||||||
// 初始化SQL Server数据库连接
|
|
||||||
$cfc = Db::connect('cfc_db');
|
$cfc = Db::connect('cfc_db');
|
||||||
// 查询需要处理的原始数据
|
$page = 1;
|
||||||
$yuanshi_data = $cfc->table('linshi_caidan_biao')
|
$data = input();
|
||||||
->where(['pic_clean' => 1,'is_move_ok'=>0])
|
$page = $data['page'];
|
||||||
->page("1,100")
|
// 查食谱
|
||||||
->field('id,pic_url,name,yuanshi_id,category,pic_clean')
|
|
||||||
->select();
|
|
||||||
// dump($yuanshi_data);
|
|
||||||
// die;
|
|
||||||
|
|
||||||
$yuanshi_mulu = 'D:\phpstudy_pro\WWW\reedaw\SchoolPhysicalExamination\public\kitchenscale_all\cook_img';
|
|
||||||
$new_mulu = 'D:\phpstudy_pro\WWW\reedaw\SchoolPhysicalExamination\public\kitchenscale_all\cook_img\linshi';
|
|
||||||
|
|
||||||
|
|
||||||
$result = [
|
// $img_data = $cfc->table('app_user_upload_img')->where(["special_record_str"=>$cookbook_data[0]['original_cookbook_id']])->field('id,special_record_str')->select();
|
||||||
'all'=>count($yuanshi_data),
|
$img_data = $cfc->table('app_user_upload_img')->where(["operate_log"=>0])->page("$page,1")->field('id,special_record_str')->select();
|
||||||
'ok'=>0,
|
if(count($img_data) <= 0){
|
||||||
'no'=>0,
|
return $this->msg(99999,'没了',[]);
|
||||||
'none'=>0,
|
|
||||||
];
|
|
||||||
|
|
||||||
$temporary_arr_data = [];
|
|
||||||
$temporary_arr_ok = [];
|
|
||||||
$temporary_arr_none = [];
|
|
||||||
foreach ($yuanshi_data as $key => $value) {
|
|
||||||
|
|
||||||
// 先判断是不是个有效的图片名字
|
|
||||||
if (preg_match('/\.jpg$/i', $value['pic_url'])) {
|
|
||||||
// 是
|
|
||||||
// 判断目录下是否有这个文件
|
|
||||||
if (!file_exists($yuanshi_mulu.DS.$value['pic_url'])) {
|
|
||||||
$result['none'] = $result['none']+1;
|
|
||||||
array_push($temporary_arr_none,$value['yuanshi_id']);
|
|
||||||
continue;
|
|
||||||
}else{
|
|
||||||
$result['ok'] = $result['ok']+1;
|
|
||||||
array_push($temporary_arr_data,[
|
|
||||||
'user_token' => 'caadd1be045a65f30b92aa805f1de54a',
|
|
||||||
'pic_name' => $value['pic_url'],
|
|
||||||
'pic_url' => "https://tc.pcxbc.com/kitchenscale_all/cook_img/".$value['pic_url'],
|
|
||||||
'create_time' => date('Y-m-d H:i:s'),
|
|
||||||
'special_record_str' => $value['yuanshi_id']
|
|
||||||
]);
|
|
||||||
rename($yuanshi_mulu.DS.$value['pic_url'], $new_mulu.DS.$value['pic_url'])
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result['none'] = $result['none']+1;
|
|
||||||
array_push($temporary_arr_none,$value['yuanshi_id']);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
$cookbook_data = $cfc->table('app_user_cookbook')->where(['original_cookbook_id'=>$img_data[0]['special_record_str']])->field('id')->select();
|
||||||
|
if(count($cookbook_data) <= 0){
|
||||||
|
return $this->msg(0,'no1',[]);
|
||||||
}
|
}
|
||||||
// 启动事务
|
// 启动事务
|
||||||
$cfc->startTrans();
|
$cfc->startTrans();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if($result['ok'] > 0){
|
$cfc->table('app_user_cookbook')->where(['original_cookbook_id'=>$img_data[0]['special_record_str']])->update(['cover'=>$img_data[0]['id']]);
|
||||||
$cfc->table('app_user_upload_img')->insertAll($temporary_arr_data);
|
$cfc->table('app_user_upload_img')->where(['id'=>$img_data[0]['id']])->update(['operate_log'=>1]);
|
||||||
$cfc->table('linshi_caidan_biao')->where("yuanshi_id in ('".implode("','",$temporary_arr_ok)."')")->update(['is_move_ok'=>1]);
|
|
||||||
}
|
|
||||||
if($result['none'] > 0){
|
|
||||||
$cfc->table('linshi_caidan_biao')->where("yuanshi_id in ('".implode("','",$temporary_arr_none)."')")->update(['is_move_ok'=>2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cfc->commit();
|
$cfc->commit();
|
||||||
dump($result);
|
return $this->msg(0,'ok',['num'=>$img_data[0]['special_record_str']]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$cfc->rollback();
|
$cfc->rollback();
|
||||||
dump($e);
|
return $this->msg(0,'no2',[]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dump($result);
|
// 从execl直接导入菜谱
|
||||||
dump($temporary_arr_ok);
|
public function execl_import_cookbook(){
|
||||||
dump($temporary_arr_no);
|
|
||||||
dump($temporary_arr_none);
|
|
||||||
dump($temporary_arr_data);
|
|
||||||
die;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,24 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>洗数据</title>
|
<title>洗数据</title>
|
||||||
<script src="/x_admin/js/jq.js"></script>
|
<script src="/x_admin/js/jq.js"></script>
|
||||||
|
<style>
|
||||||
|
.cook{
|
||||||
|
width:90vw;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div onclick="start_action()">开始</div>
|
<div onclick="start_action()">开始</div>
|
||||||
<div>当前第<span class="jilu">1</span>页</div>
|
<div>当前第<span class="jilu">1</span>页</div>
|
||||||
<div>累积成功<span class="ok">0</span>项</div>
|
<div>累积成功<span class="ok">0</span>项</div>
|
||||||
<div>累积失败<span class="no">0</span>项</div>
|
<div>查找菜谱失败<span class="no1">0</span>项</div>
|
||||||
|
<div>修改数据失败<span class="no2">0</span>项</div>
|
||||||
|
<div class="cook"><span style="width:89vw;">成功原始菜谱id:</span><br/></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -19,8 +31,46 @@
|
||||||
var page = 1;
|
var page = 1;
|
||||||
var page_str = 1;
|
var page_str = 1;
|
||||||
var ok_str = 0;
|
var ok_str = 0;
|
||||||
var no_str = 0;
|
var no1_str = 0;
|
||||||
|
var no2_str = 0;
|
||||||
|
|
||||||
|
// // 本地数据处理进图片表
|
||||||
|
// function start_action(){
|
||||||
|
// $.ajax({
|
||||||
|
// // url:"clean_data_all", //请求的url地址
|
||||||
|
// url:"caipu_shuju_chuli", //请求的url地址
|
||||||
|
// dataType:"json", //返回格式为json
|
||||||
|
// async:true,//请求是否异步,默认为异步,这也是ajax重要特性
|
||||||
|
// data:{"page":page}, //参数值
|
||||||
|
// type:"POST", //请求方式
|
||||||
|
// success:function(req){
|
||||||
|
// //请求成功时处理
|
||||||
|
// if(req.code == 0){
|
||||||
|
// $('.jilu').html(page_str)
|
||||||
|
// page_str = page_str+1;
|
||||||
|
// ok_str = ok_str + req.data.ok
|
||||||
|
// no1_str = no1_str + req.data.no
|
||||||
|
// no2_str = no2_str + req.data.none
|
||||||
|
|
||||||
|
|
||||||
|
// $('.ok').html(ok_str)
|
||||||
|
|
||||||
|
// $('.no1').html(no1_str)
|
||||||
|
// $('.no2').html(no2_str)
|
||||||
|
// setTimeout(() => {
|
||||||
|
// start_action()
|
||||||
|
// }, 500);
|
||||||
|
|
||||||
|
// }else if(req.code == 99999){
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// error:function(){
|
||||||
|
// //请求出错处理
|
||||||
|
// }});
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 处理图片表跟食谱表的数据统一
|
||||||
function start_action(){
|
function start_action(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
// url:"clean_data_all", //请求的url地址
|
// url:"clean_data_all", //请求的url地址
|
||||||
|
|
@ -31,17 +81,28 @@
|
||||||
type:"POST", //请求方式
|
type:"POST", //请求方式
|
||||||
success:function(req){
|
success:function(req){
|
||||||
//请求成功时处理
|
//请求成功时处理
|
||||||
|
console.log(req.msg)
|
||||||
if(req.code == 0){
|
if(req.code == 0){
|
||||||
page_str = page_str+1;
|
|
||||||
$('.jilu').html(page_str)
|
$('.jilu').html(page_str)
|
||||||
ok_str = ok_str + req.data.ok
|
page_str = page_str+1;
|
||||||
no_str = no_str + req.data.no
|
if(req.msg == 'ok'){
|
||||||
|
ok_str = ok_str + 1
|
||||||
$('.ok').html(ok_str)
|
$('.ok').html(ok_str)
|
||||||
$('.no').html(no_str)
|
$('.cook').append('<span>'+req.data.num+',</span>');
|
||||||
|
}
|
||||||
|
if(req.msg == 'no1'){
|
||||||
|
no1_str = no1_str + 1
|
||||||
|
// console.log(no_str)
|
||||||
|
$('.no1').html(no1_str)
|
||||||
|
}
|
||||||
|
if(req.msg == 'no2'){
|
||||||
|
no2_str = no2_str + 1
|
||||||
|
// console.log(no_str)
|
||||||
|
$('.no2').html(no2_str)
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
start_action()
|
start_action()
|
||||||
}, 1000);
|
}, 500);
|
||||||
|
|
||||||
}else if(req.code == 99999){
|
}else if(req.code == 99999){
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue