1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- // +----------------------------------------------------------------------
- // | 文件说明:幻灯片
- // +----------------------------------------------------------------------
- // | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Author: wuwu <15093565100@163.com>
- // +----------------------------------------------------------------------
- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | Date: 2017-5-25
- // +----------------------------------------------------------------------
- namespace api\rob\controller;
- use app\rob\model\OrderModel;
- use app\rob\model\OrderProductModel;
- use cmf\controller\RestBaseController;
- class MyController extends RestBaseController
- {
- /**
- * 列表
- */
- public function index()
- {
- $param = $this->request->param();
- $page = empty($param['page']) ? 1 : $param['page'];
- $size = empty($param['size']) ? 10 : $param['size'];
- //搜索条件
- $where = [];
- if (!empty($param['status'])) {
- $where[] = ['status', '=', $param['status']];
- }
- $list = OrderModel::with('orderProduct')->where($where)
- ->order('update_time desc')
- ->page($page, $size)
- ->select();
- //数据处理
- if (!$list->isEmpty()) {
- foreach ($list as $v) {
- foreach ($v['order_product'] as $product) {
- $product['product_image'] = cmf_get_image_preview_url($product['product_image']);
- }
- $v['create_time'] = date('Y-m-d H:i:s', $v['create_time']);
- $v['status_text'] = $v['status_text'];
- }
- }
- $this->success('成功', $list);
- }
- /**
- * 确认订单
- */
- public function orderConfirm()
- {
- $id = $this->request->param('id');
- OrderModel::update(['status' => 2, 'receive_time' => time()], ['id' => $id]);
- $this->success('操作成功');
- }
- /**
- * 获取二维码
- */
- public function qrcode()
- {
- include('../extend/util/phpqrcode/qrlib.php');
- $id = $this->request->param('id');
- $product = OrderProductModel::where('order_id',$id)->find();
- if (empty($product)) {
- $this->error('该订单不支持二维码!');
- }
- return \QRcode::png($product['code']);
- // $this->success('成功',);
- }
- }
|