|
|
@@ -56,30 +56,16 @@ class ContractTemplate extends BaseController
|
|
|
$post = UtilService::getMore([
|
|
|
['id', ''],
|
|
|
['title', '', 'empty', '请填写模板标题'],
|
|
|
-// ['price','0','is_numeric','请输入正确的模板售价'],
|
|
|
-// ['old_price','0','is_numeric','请输入正确的模板原价'],
|
|
|
['imgs', [], 'empty', '请上传商品主图'],
|
|
|
-// ['imgs',[]],
|
|
|
['is_show', '0'],
|
|
|
-// ['is_recommend','0'],
|
|
|
-// ['is_init','0'],
|
|
|
-// ['code','','empty','请输入CODE'],
|
|
|
-// ['status','0'],
|
|
|
['content', []],
|
|
|
], $request);
|
|
|
$save = [];
|
|
|
$save["title"] = $post["title"];
|
|
|
-// $save["price"] = floatval($post["price"]);
|
|
|
-// $save["old_price"] = floatval($post["old_price"]);
|
|
|
$save["is_show"] = (int)$post["is_show"] == 1 ? 1 : 0;
|
|
|
$save["imgs"] = empty($post["imgs"]) ? "" : implode(",", $post["imgs"]);
|
|
|
-// $save["is_hot"] = (int)$post["is_hot"] == 1 ? 1 : 0;
|
|
|
-// $save["is_recommend"] = (int)$post["is_recommend"]== 1 ? 1 : 0;
|
|
|
-// $save["is_init"] = (int)$post["is_init"] == 1 ? 1 : 0;
|
|
|
$save["content"] = json_encode($post["content"]);;
|
|
|
-// $save["unreal_sales"] = (int)$post["unreal_sales"];
|
|
|
$save["admin_time"] = time();
|
|
|
- @file_put_contents('quanju.txt', json_encode($request->adminInfo) . "-管理员信息\r\n", 8);
|
|
|
|
|
|
if (!empty($request->adminInfo) && isset($request->adminInfo['id'])) {
|
|
|
$save["admin_id"] = $request->adminInfo['id'];
|
|
|
@@ -87,19 +73,10 @@ class ContractTemplate extends BaseController
|
|
|
// 处理 id 不存在的情况
|
|
|
$save["admin_id"] = 0; // 或者其他默认值
|
|
|
}
|
|
|
-// if($save["price"]<0 || $save["old_price"]<0){
|
|
|
-// return app('json')->fail("请输入正确的价格");
|
|
|
-// }
|
|
|
+
|
|
|
|
|
|
$id = empty($post["id"]) ? 0 : (int)$post["id"];
|
|
|
-// $codeWhere[]=["code","=",$save["code"]];
|
|
|
-// if ($id > 0) {
|
|
|
-// $codeWhere[] = ["id", "<>", $id];
|
|
|
-// }
|
|
|
-// $count = (new ContractTemplateModel)->where($codeWhere)->where("id","<>",$id)->count();
|
|
|
-// if($count>0){
|
|
|
-// return app('json')->fail("当前code已存在");
|
|
|
-// }
|
|
|
+
|
|
|
if (empty($id) || $id == "0") {
|
|
|
$save["time"] = time();
|
|
|
$r = (new ContractTemplateModel)->insert($save);
|