public static function add(array $args) { $args['receiver_id'] = $args['receiver_id'] ? $args['receiver_id'] : 0; $comment = ['parent_id' => $args['parent_id'], 'pro_id' => $args['pro_id'], 'sender_id' => $args['sender_id'], 'receiver_id' => $args['receiver_id'], 'content' => $args['content'], 'status' => 0, 'reg_time' => time()]; $comm = self::create($comment); $goods = Goods::find($comm->pro_id); $info = Info::where('user_id', $comm->sender_id)->first(); $sender = User::find($comm->sender_id); $receiver = User::find($comm->receiver_id); $comm->sender_author = $sender->username; $comm->receiver_author = $receiver->usernmae; $comm->pro_name = $goods->pro_name; $comm->src = 'uploads/' . $info->head_photo; $comm->comments = []; return self::success($comm->toArray()); }
public function actionGetGoodsByEmailProviser($id) { return Goods::find()->withEmailProvider($id)->asArray()->all(); }