Commit a69e5d0d authored by clone's avatar clone

1

parent de8f7732
......@@ -72,13 +72,19 @@ class FindShop extends Basic
"update_time" => date("Y-m-d H:i:s", time()),
);
//修改数据
$findShopModel = new UFindShop();
if (!empty($params["id"]) && $params["id"] > 0) {
$updateParams["id"] = $params["id"];
$where_["id"] = $params["id"];
$id = $findShopModel->updateFindShop($where_, $updateParams);
} else {//新增数据
$updateParams["create_time"] = date("Y-m-d H:i:s", time());
}
$findShopModel = new UFindShop();
$id = $findShopModel->addFindShop($updateParams);
}
if ($params["id"]) {
}
if ($id > 0) {
return $this->response("200", "数据保存成功", ["id" => $id]);
} else {
......
......@@ -56,9 +56,9 @@ class UFindShop extends Model{
{
Db::startTrans();
try {
$this->db_->insert($params);
$id = $this->db_->insertGetId($params);
Db::commit();
return 1;
return $id;
} catch (\Exception $e) {
Db::rollback();
return 0;
......@@ -76,7 +76,7 @@ class UFindShop extends Model{
try {
$this->db_->where($where)->update($params);
Db::commit();
return 1;
return $where["id"];
} catch (\Exception $e) {
Db::rollback();
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment