|
@@ -137,50 +137,67 @@ class Goldprice extends BaseController
|
|
|
$update = Db::name("gold_price1")->save($info);
|
|
|
return $update? error_show(0,"{$msg}成功"):error_show(1004,"{$msg}失败");
|
|
|
}
|
|
|
- public function edit(){
|
|
|
- $id = isset($this->post['id']) && $this->post['id'] !==""? intval($this->post['id']):"";
|
|
|
- if($id==""){
|
|
|
- return error_show(1002,"参数id不能为空");
|
|
|
- }
|
|
|
- $info = Db::name("gold_price1")->where(['id'=>$id,"is_del"=>0])->find();
|
|
|
- if($info==""){
|
|
|
- return error_show(1003,"未找到数据");
|
|
|
- }
|
|
|
- $type = isset($this->post['type']) && $this->post['type'] !=="" ?trim($this->post['type']):"";
|
|
|
- if($type==""){
|
|
|
- return error_show(1002,"参数type不能为空");
|
|
|
- }
|
|
|
- $price = isset($this->post['price']) && $this->post['price'] !=="" ? floatval($this->post['price']):"";
|
|
|
- if($price==""){
|
|
|
- return error_show(1002,"参数price不能为空");
|
|
|
- }
|
|
|
- $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
|
|
|
- if($token==''){
|
|
|
- return error_show(1005,"参数token不能为空");
|
|
|
- }
|
|
|
- $user =GetUserInfo($token);
|
|
|
- if(empty($user)||$user['code']!=0){
|
|
|
- return error_show(1002,"创建人数据不存在");
|
|
|
- }
|
|
|
- $action_id= isset($user["data"]['id']) ? $user["data"]['id'] : "";
|
|
|
- $action_name= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
|
|
|
- $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"0";
|
|
|
- $data=[
|
|
|
- "id"=>$id,
|
|
|
- "type"=>$type,
|
|
|
- "price"=>$price,
|
|
|
- "action_name"=>$action_name,
|
|
|
- "action_id"=>$action_id,
|
|
|
- "status"=>$status,
|
|
|
- "is_del"=>0,
|
|
|
- //"addtime"=>date("Y-m-d H:i:s")
|
|
|
- ];
|
|
|
- $datainfo= Db::name("gold_price1")->save($data);
|
|
|
- if($datainfo){
|
|
|
- return error_show(0,"更新成功");
|
|
|
- }else{
|
|
|
- return error_show(1002,"更新失败");
|
|
|
+// public function edit(){
|
|
|
+// $id = isset($this->post['id']) && $this->post['id'] !==""? intval($this->post['id']):"";
|
|
|
+// if($id==""){
|
|
|
+// return error_show(1002,"参数id不能为空");
|
|
|
+// }
|
|
|
+// $info = Db::name("gold_price1")->where(['id'=>$id,"is_del"=>0])->find();
|
|
|
+// if($info==""){
|
|
|
+// return error_show(1003,"未找到数据");
|
|
|
+// }
|
|
|
+// $type = isset($this->post['type']) && $this->post['type'] !=="" ?trim($this->post['type']):"";
|
|
|
+// if($type==""){
|
|
|
+// return error_show(1002,"参数type不能为空");
|
|
|
+// }
|
|
|
+// $price = isset($this->post['price']) && $this->post['price'] !=="" ? floatval($this->post['price']):"";
|
|
|
+// if($price==""){
|
|
|
+// return error_show(1002,"参数price不能为空");
|
|
|
+// }
|
|
|
+// $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
|
|
|
+// if($token==''){
|
|
|
+// return error_show(1005,"参数token不能为空");
|
|
|
+// }
|
|
|
+// $user =GetUserInfo($token);
|
|
|
+// if(empty($user)||$user['code']!=0){
|
|
|
+// return error_show(1002,"创建人数据不存在");
|
|
|
+// }
|
|
|
+// $action_id= isset($user["data"]['id']) ? $user["data"]['id'] : "";
|
|
|
+// $action_name= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
|
|
|
+// $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"0";
|
|
|
+// $data=[
|
|
|
+// "id"=>$id,
|
|
|
+// "type"=>$type,
|
|
|
+// "price"=>$price,
|
|
|
+// "action_name"=>$action_name,
|
|
|
+// "action_id"=>$action_id,
|
|
|
+// "status"=>$status,
|
|
|
+// "is_del"=>0,
|
|
|
+// //"addtime"=>date("Y-m-d H:i:s")
|
|
|
+// ];
|
|
|
+// $datainfo= Db::name("gold_price1")->save($data);
|
|
|
+// if($datainfo){
|
|
|
+// return error_show(0,"更新成功");
|
|
|
+// }else{
|
|
|
+// return error_show(1002,"更新失败");
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ public function lastlist(){
|
|
|
+ $where=['is_del'=>0];
|
|
|
+ $type=isset($this->post['type'])&&$this->post['type']!=""?intval($this->post['type']):"";
|
|
|
+ if($type!==""){
|
|
|
+ $where['type']=$type;
|
|
|
+ }
|
|
|
+ $ids =Db::name("gold_price1")->where(['is_del'=>0])->group("type")->column("max(id) as id");
|
|
|
+ $where['id']=$ids;
|
|
|
+ $list =Db::name("gold_price1")->where($where)->select();
|
|
|
+ $data=[];
|
|
|
+ foreach ($list as $value){
|
|
|
+ $value['type_cn']=$this->gold[$value['type']];
|
|
|
+ $data[]=$value;
|
|
|
}
|
|
|
+ return app_show(0,"获取成功",$data);
|
|
|
}
|
|
|
|
|
|
public function ratelist(){
|