日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php写简单接口_php写接口的日常

發(fā)布時間:2025/3/8 php 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php写简单接口_php写接口的日常 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

php寫接口的日常

/*

評論列表

*/

public function commentListW(){

$base = new Base();

$info = $base->getUserByToken();

$shop_id = $info['shop_id'];

$page = $this->data['page']?:1;

$pagesize = $this->data['pagesize']?:C('ROLLPAGE');

$search = $this->data['search'];

$and = "";

if($search){

$and .= " and (c.c_name like '%{$search}%' or cu.customer_name like '%{$search}%')";

}

$sql0 = "select count(c.c_id) as itemcount from `comment` as c left join `customer` as cu on c.customer_id=cu.customer_id where c.shop_id='{$shop_id}' and c.com_status='0'{$and}";

$itemcount = M()->query($sql0)[0]['itemcount'];

$pagecount = ceil($itemcount/$pagesize);

$limit = ($page-1)*$pagesize;

$offset = " limit {$limit},{$pagesize}";

$sql1 = "select c.c_id,c.c_name,c.c_pic,c.c_type,cu.customer_name,cu.headimgurl,c.com_content,c.com_time,c.reply_time,c.thumb_num,c.pic_num,c.com_reply,c.is_reply,c.com_status,c.com_status from `comment` as c left join `customer` as cu on c.customer_id=cu.customer_id where c.shop_id='{$shop_id}' and c.com_status='0'{$and} order by c.com_time desc {$offset}";

$data = M()->query($sql1);

$ret = array();

$ret['data'] = $data;

$ret['page'] = array(

'pagecount'=>(int)$pagecount,

'itemcount'=>(int)$itemcount,

);

return $ret;

}

/*

點贊/取消點贊

*/

public function doThumb(){

$art_id = $this->data['art_id'];

$customer_id = $this->data['customer_id'];

$brand_id = $this->data['brand_id'];

$time = time();

$data = $this->getThumb();

if($data){

$thumb_id = $data['thumb_id'];

$thumb_status = $data['thumb_status'];

if($thumb_status==0){

$sql = "update `brand_article_thumb` set thumb_status='1' where thumb_id='{$thumb_id}'";

}else{

$sql = "update `brand_article_thumb` set thumb_status='0' where thumb_id='{$thumb_id}'";

}

}else{

$sql = "insert into `brand_article_thumb` (art_id,customer_id,thumb_time,brand_id) values ('{$art_id}','{$customer_id}','{$time}','{$brand_id}')";

}

$ret = M()->execute($sql);

if($ret<0){

return false;

}else{

return true;

}

}

?著作權(quán)歸作者所有:來自51CTO博客作者Lee_吉的原創(chuàng)作品,如需轉(zhuǎn)載,請注明出處,否則將追究法律責任

總結(jié)

以上是生活随笔為你收集整理的php写简单接口_php写接口的日常的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。