1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
-
- namespace app\user\logic;
-
- use think\Model;
- use think\Db;
- use think\Page;
- use think\Config;
-
-
- load_trait('controller/Jump');
- class FunctionLogic extends Model
- {
- use \traits\controller\Jump;
-
-
-
- public function GetAllCommentInfo($users_id = null, $order_code = null)
- {
- $functionLogic = new \app\common\logic\FunctionLogic;
- $functionLogic->check_authorfile(2);
-
- $where = [
- 'a.order_id' => ['>', 0],
- 'a.users_id' => $users_id
- ];
- if (!empty($order_code)) $where['a.order_code'] = ['LIKE', "%{$order_code}%"];
-
- $count = Db::name('shop_order_comment')->alias('a')->where($where)->count('comment_id');
- $pageObj = new Page($count, config('paginate.list_rows'));
-
-
- $field = 'a.comment_id, a.order_id, a.order_code, a.product_id, a.total_score, a.is_new_comment, a.is_show, a.add_time, b.product_name, b.product_price, b.litpic as product_img, b.num as product_num';
- $Comment = Db::name('shop_order_comment')->alias('a')->where($where)
- ->field($field)
- ->join('__SHOP_ORDER_DETAILS__ b', 'a.details_id = b.details_id', 'LEFT')
- ->limit($pageObj->firstRow.','.$pageObj->listRows)
- ->order('comment_id desc')
- ->select();
-
- $New = get_archives_data($Comment, 'product_id');
- foreach ($Comment as &$value) {
-
- $value['product_img'] = handle_subdir_pic(get_default_pic($value['product_img']));
-
- $value['ArchivesUrl'] = urldecode(arcurl('home/Product/view', $New[$value['product_id']]));
-
- $value['OrDetailsUrl'] = url('user/Shop/shop_order_details', ['order_id' => $value['order_id']]);
-
- $value['ViewCommentUrl'] = $value['ArchivesUrl'];
-
- $value['total_score'] = empty($value['is_new_comment']) ? GetScoreArray($value['total_score']) : $value['total_score'];
-
- $value['order_total_score'] = Config::get('global.order_total_score')[$value['total_score']];
- }
-
- $Return['Comment'] = $Comment;
- $Return['pageStr'] = $pageObj->show();
-
- return $Return;
- }
- }
|