Commit 4c6949fc by LiuJunYi

我的收藏BUG

parent 2dda0176
......@@ -27,7 +27,7 @@ class Base extends Controller
// var_dump($params);
// echo $this->getSignature($params); exit;
//验证签名
// 验证签名
// if (!$this->checkSignature($params)) {
// echo json_encode(["code" => 1, "msg" => "auth failed"]);
// die;
......
......@@ -356,6 +356,7 @@ class Order extends Base
->where('uid', $uid)
->where('type', 1)
->page($p, $page)
->order('id','desc')
->select();
$order = collection($order);
if ($order->isEmpty()) {
......
......@@ -233,7 +233,7 @@ class Project extends Base
if (!$project) return ['code' => 1, 'msg' => '活动或该商家不存在'];
if ($data) {
//已经收藏->取消收藏
if ($data->delete()) {
if ($data->delete(true)) {
$project->collect_num--;
$project->save();
return ['code' => 0, 'msg' => '取消收藏成功!', 'collect'=>'remove'];
......
......@@ -197,8 +197,10 @@ class User extends Base
$page = input('post.page/d', 8);
$list = collection(UserModel::get($uid)->project()->page($p, $page)->select());
if ($list->isEmpty()) {
return ['code' => 1, 'msg' => '没有更多'];
}
......
......@@ -33,7 +33,7 @@ class User extends BaseModel
// 用户收藏多对多
public function project()
{
return $this->belongsToMany('Project', 'user_collections', 'pid', 'uid');
return $this->belongsToMany('Project', 'user_collections', 'pid', 'uid')->order('pivot.id','desc');
}
}
\ No newline at end of file
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