示例#1
0
 /**
  * [查询用户发布的3产品]
  * @param  [int] $uid [产品id]
  * @return [json_encode]
  * 关注接口:http://dev.idaiyan.cn/index.php?r=product/myproduct&uid=24
  */
 public function actionMyproduct($uid)
 {
     $model_Base = new IProductBase();
     $uid = intval($uid);
     $follow = $model_Base->myProduct($uid);
     foreach ($follow as $key => $val) {
         $follow[$key]['name'] = strip_tags($val['name']);
         if ($val['album']) {
             $follow[$key]['album'] = '/' . $val['album'] . ProductImage::THUMB_POSTFIX;
         } else {
             $follow[$key]['album'] = Yii::$app->params['idaiyan-static'] . "static/modules/home/images/nopic.jpg";
         }
     }
     if ($follow) {
         $res = array('code' => '0', 'msg' => '', 'data' => $follow);
     } else {
         $res = array('code' => '1', 'msg' => '参数错误', 'data' => '');
     }
     return json_encode($res);
 }