Authored by Rock Zhang

给意见反馈添加图片选项

... ... @@ -344,14 +344,18 @@ class UserData
*
* @param int $uid 用户ID
* @param string $content 意见内容
* @param mixed $image 图片地址
* @param int $suggest_type 意见类型
* @return array 意见反馈接口返回的数据
*/
public static function savesuggestData($uid, $content, $suggest_type)
public static function savesuggestData($uid, $content, $image, $suggest_type)
{
$param = Yohobuy::param();
$param['uid'] = $uid;
$param['content'] = $content;
if($image !== null) {
$param['image'] = $image;
}
$param['suggest_type'] = $suggest_type;
$param['client_secret'] = Sign::getSign($param);
... ...
... ... @@ -187,7 +187,11 @@ class Images
if(count($file) == 1 || !is_array($file))
{
$imgList['imgList'][] = array('imgUrl' => self::getSourceUrl(current($result['data']['imagesList']), 'suggest') . $imgExtra);
$imgRelUrl = current($result['data']['imagesList']);
$imgList['imgList'][] = array(
'imgUrl' => self::getSourceUrl($imgRelUrl, 'suggest') . $imgExtra,
'imgRelUrl' => $imgRelUrl
);
}
else
{
... ... @@ -195,6 +199,7 @@ class Images
foreach ($result['data']['imagesList'] as $val) {
$img = array();
$img['imgUrl'] = self::getSourceUrl($val, 'suggest') . $imgExtra;
$img['imgRelUrl'] = $val;
$imgList['imgList'][] = $img;
}
}
... ...
... ... @@ -384,7 +384,8 @@ class HomeController extends AbstractAction
$uid = $this->getUid();
$content = $this->post('content', '');
$suggest_type = $this->post('suggest_type', 2);
$result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type);
$image = $this->post('image', null);
$result = \Index\UserModel::saveSuggestData($uid, $content, $image, $suggest_type);
$this->echoJson($result);
}
... ...
... ... @@ -487,15 +487,16 @@ class UserModel
*
* @param int $uid 用户ID
* @param string $content 意见内容
* @param mixed $image 图片地址
* @param int $suggest_type 意见类型
* @return array|mixed 保存意见反馈数据之后的返回
*/
public static function saveSuggestData($uid, $content, $suggest_type)
public static function saveSuggestData($uid, $content, $image, $suggest_type)
{
$result = array('code' => 400, 'message' => '保存出错');
// 调用接口保存意见反馈数据
$save = UserData::savesuggestData($uid, $content, $suggest_type);
$save = UserData::savesuggestData($uid, $content, $image, $suggest_type);
if (isset($save['code']) && $save['code'] == 200) {
$result['code'] = 200;
... ...