|
@@ -230,6 +230,7 @@ class NewsService implements NewsServiceInterface
|
|
|
*/
|
|
|
public function addArticle(array $data): array
|
|
|
{
|
|
|
+ var_dump($data, '----------12-----------1');
|
|
|
var_dump($data, '----------12-----------1');
|
|
|
unset($data['user_type']);
|
|
|
// unset($data['web_site_id']);
|
|
@@ -247,6 +248,16 @@ class NewsService implements NewsServiceInterface
|
|
|
unset($data['suvey_array']);
|
|
|
unset($data['website_id']);
|
|
|
|
|
|
+ if ($data['hits'] == '') {
|
|
|
+ $data['hits'] = 0;
|
|
|
+ }
|
|
|
+ if ($data['is_original'] == '') {
|
|
|
+ $data['is_original'] = 0;
|
|
|
+ }
|
|
|
+ if ($data['status'] == '') {
|
|
|
+ $data['status'] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
$articleData = $data;
|
|
|
unset($articleData['content']);
|
|
|
$id = Article::insertGetId($articleData);
|
|
@@ -260,7 +271,8 @@ class NewsService implements NewsServiceInterface
|
|
|
if ($is_survey == 1) {
|
|
|
//生成年月日时分秒+8位随机数
|
|
|
$uuid = date('YmdHis') . rand(10000000, 99999999);
|
|
|
- $suveys_array = json_decode($suvey_array);
|
|
|
+ var_dump($suvey_array, 'suvey_array________');
|
|
|
+ $suveys_array = is_array($suvey_array) ? $suvey_array : json_decode($suvey_array);
|
|
|
var_dump($suveys_array, '---------------------1');
|
|
|
var_dump($suvey_array, '---------------------2');
|
|
|
$suvey_data = [];
|
|
@@ -338,6 +350,7 @@ class NewsService implements NewsServiceInterface
|
|
|
*/
|
|
|
public function updateArticle(array $data): array
|
|
|
{
|
|
|
+ var_dump($data, '----------12-----------1');
|
|
|
Db::beginTransaction();
|
|
|
unset($data['user_type']);
|
|
|
// unset($data['web_site_id']);
|
|
@@ -352,6 +365,15 @@ class NewsService implements NewsServiceInterface
|
|
|
unset($data['survey_name']);
|
|
|
unset($data['suvey_array']);
|
|
|
unset($data['website_id']);
|
|
|
+ if ($data['hits'] == '') {
|
|
|
+ $data['hits'] = 0;
|
|
|
+ }
|
|
|
+ if ($data['is_original'] == '') {
|
|
|
+ $data['is_original'] = 0;
|
|
|
+ }
|
|
|
+ if ($data['status'] == '') {
|
|
|
+ $data['status'] = 0;
|
|
|
+ }
|
|
|
|
|
|
$data['cat_arr_id'] = isset($data['cat_arr_id']) ? json_encode($data['cat_arr_id']) : '';
|
|
|
$data['tag'] = isset($data['tag']) ? json_encode($data['tag']) : '';
|
|
@@ -370,49 +392,51 @@ class NewsService implements NewsServiceInterface
|
|
|
//处理投票
|
|
|
$id = $data['id'];
|
|
|
$surveydata = ArticleSurvey::where(['art_id' => $data['id']])->delete();
|
|
|
- var_dump($surveydata, 'suvey_array________delete');
|
|
|
+ var_dump($suvey_array, 'suvey_array________delete');
|
|
|
|
|
|
//处理投票
|
|
|
if ($is_survey == 1) {
|
|
|
//生成年月日时分秒+8位随机数
|
|
|
$uuid = date('YmdHis') . rand(10000000, 99999999);
|
|
|
- $suveys_array = json_decode($suvey_array);
|
|
|
+ $suveys_array = is_array($suvey_array) ? $suvey_array : json_decode($suvey_array);
|
|
|
var_dump($suveys_array, '---------------------1');
|
|
|
var_dump($suvey_array, '---------------------2');
|
|
|
$suvey_data = [];
|
|
|
- foreach ($suveys_array as $key => $value) {
|
|
|
- if ($value == '') {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (is_array($value)) {
|
|
|
- $suvey_data[] = [
|
|
|
- 'sur_id' => $uuid,
|
|
|
- 'art_id' => $id,
|
|
|
- 'website_id' => $website_id ?? 2,
|
|
|
- 'survey_name' => $survey_name,
|
|
|
- 'choice_name' => $value[1],
|
|
|
- 'is_other' => 1,
|
|
|
- 'other_id' => 0,
|
|
|
- 'results' => 0,
|
|
|
|
|
|
- ];
|
|
|
- } else {
|
|
|
- $suvey_data[] = [
|
|
|
- 'sur_id' => $uuid,
|
|
|
- 'art_id' => $id,
|
|
|
- 'website_id' => $website_id ?? 2,
|
|
|
- 'survey_name' => $survey_name,
|
|
|
- 'choice_name' => $value,
|
|
|
- 'is_other' => 0,
|
|
|
- 'other_id' => 0,
|
|
|
- 'results' => 0,
|
|
|
+ if (is_array($suveys_array)) {
|
|
|
+ foreach ($suveys_array as $key => $value) {
|
|
|
+ if ($value == '') {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (is_array($value)) {
|
|
|
+ $suvey_data[] = [
|
|
|
+ 'sur_id' => $uuid,
|
|
|
+ 'art_id' => $id,
|
|
|
+ 'website_id' => $website_id ?? 2,
|
|
|
+ 'survey_name' => $survey_name,
|
|
|
+ 'choice_name' => $value[1],
|
|
|
+ 'is_other' => 1,
|
|
|
+ 'other_id' => 0,
|
|
|
+ 'results' => 0,
|
|
|
|
|
|
- ];
|
|
|
- }
|
|
|
- if (empty($suvey_data)) {
|
|
|
- throw new \Exception("投票数据为空");
|
|
|
- }
|
|
|
+ ];
|
|
|
+ } else {
|
|
|
+ $suvey_data[] = [
|
|
|
+ 'sur_id' => $uuid,
|
|
|
+ 'art_id' => $id,
|
|
|
+ 'website_id' => $website_id ?? 2,
|
|
|
+ 'survey_name' => $survey_name,
|
|
|
+ 'choice_name' => $value,
|
|
|
+ 'is_other' => 0,
|
|
|
+ 'other_id' => 0,
|
|
|
+ 'results' => 0,
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if (empty($suvey_data)) {
|
|
|
+ throw new \Exception("投票数据为空");
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
$result = ArticleSurvey::insert($suvey_data);
|
|
|
if (!$result) {
|
|
@@ -422,13 +446,15 @@ class NewsService implements NewsServiceInterface
|
|
|
if (!$result) {
|
|
|
throw new \Exception("投票失败");
|
|
|
}
|
|
|
+ } else {
|
|
|
+ $result = Article::where('id', $id)->update(['survey_id' => '', 'survey_name' => '', 'is_survey' => 0]);
|
|
|
}
|
|
|
Db::commit();
|
|
|
return Result::success([]);
|
|
|
} catch (\Throwable $ex) {
|
|
|
Db::rollBack();
|
|
|
var_dump($ex->getMessage());
|
|
|
- return Result::error("更新失败", 0);
|
|
|
+ return Result::error("更新失败1" . $ex->getMessage(), 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -455,17 +481,17 @@ class NewsService implements NewsServiceInterface
|
|
|
{
|
|
|
$where = [
|
|
|
'article.id' => $data['id'],
|
|
|
- // 'article.status'=>1
|
|
|
+
|
|
|
+ // 'article.status' => 1,
|
|
|
];
|
|
|
$result = Article::where($where)->leftJoin("article_data", "article.id", "article_data.article_id")->first();
|
|
|
- if (empty($result)) {
|
|
|
- return Result::error("查询失败", 0);
|
|
|
- }
|
|
|
- //添加投票
|
|
|
- $articleSurvey = ArticleSurvey::where(['art_id' => $data['id']])->get();
|
|
|
- $result['survey_array'] = $articleSurvey->toArray();
|
|
|
+ $articleSurvey = ArticleSurvey::where(['art_id' => $data['id']])->get()->all();
|
|
|
+ var_dump($articleSurvey, 'articleSurvey');
|
|
|
+ $info = $result;
|
|
|
+ var_dump($info, 'info');
|
|
|
+ // $info['survey_array'] = $articleSurvey == null ? [] : $info['survey_array'];
|
|
|
if ($result) {
|
|
|
- return Result::success($result->toArray());
|
|
|
+ return Result::success($info);
|
|
|
} else {
|
|
|
return Result::error("查询失败", 0);
|
|
|
}
|
|
@@ -487,11 +513,11 @@ class NewsService implements NewsServiceInterface
|
|
|
foreach ($category as $val) {
|
|
|
array_push($category_ids, $val['category_id']);
|
|
|
}
|
|
|
- if(isset($data['placeid'])){
|
|
|
- $placeid=$data['placeid']-1;
|
|
|
- $result=Article::where('status',1)->where('level',$data['level'])->whereIn("catid",$category_ids)->orderBy("updated_at","desc")->offset($placeid)->limit($data['pageSize'])->get();
|
|
|
- }else{
|
|
|
- $result=Article::where('status',1)->where('level',$data['level'])->whereIn("catid",$category_ids)->orderBy("updated_at","desc")->offset(0)->limit($data['pageSize'])->get();
|
|
|
+ if (isset($data['placeid'])) {
|
|
|
+ $placeid = $data['placeid'] - 1;
|
|
|
+ $result = Article::where('status', 1)->where('level', $data['level'])->whereIn("catid", $category_ids)->orderBy("updated_at", "desc")->offset($placeid)->limit($data['pageSize'])->get();
|
|
|
+ } else {
|
|
|
+ $result = Article::where('status', 1)->where('level', $data['level'])->whereIn("catid", $category_ids)->orderBy("updated_at", "desc")->offset(0)->limit($data['pageSize'])->get();
|
|
|
}
|
|
|
if (empty($result)) {
|
|
|
return Result::error("暂无头条新闻", 0);
|
|
@@ -524,15 +550,15 @@ class NewsService implements NewsServiceInterface
|
|
|
2 => '5',
|
|
|
3 => '0',
|
|
|
];
|
|
|
-
|
|
|
- $result = Article::where($where)->whereIn('level',$level)->orderBy("updated_at","desc")->limit($data['pagesize'])->get();
|
|
|
- }elseif($data['level']==2){
|
|
|
- $level='2';
|
|
|
- $result = Article::where($where)->where('level',$level)->orderBy("updated_at","desc")->limit($data['pagesize'])->get();
|
|
|
|
|
|
- }else{
|
|
|
- $level='3';
|
|
|
- $result = Article::where($where)->where('level',$level)->orderBy("updated_at","desc")->limit($data['pagesize'])->get();
|
|
|
+ $result = Article::where($where)->whereIn('level', $level)->orderBy("updated_at", "desc")->limit($data['pagesize'])->get();
|
|
|
+ } elseif ($data['level'] == 2) {
|
|
|
+ $level = '2';
|
|
|
+ $result = Article::where($where)->where('level', $level)->orderBy("updated_at", "desc")->limit($data['pagesize'])->get();
|
|
|
+
|
|
|
+ } else {
|
|
|
+ $level = '3';
|
|
|
+ $result = Article::where($where)->where('level', $level)->orderBy("updated_at", "desc")->limit($data['pagesize'])->get();
|
|
|
}
|
|
|
$result = $result->toArray();
|
|
|
if (!empty($result) && isset($data['placeid']) && !empty($data['placeid'])) {
|
|
@@ -542,16 +568,16 @@ class NewsService implements NewsServiceInterface
|
|
|
'level' => $level,
|
|
|
];
|
|
|
$result = Article::where($where)
|
|
|
- ->orderBy("updated_at","desc")
|
|
|
- ->offset($placeid)
|
|
|
- ->limit($data['pagesize'])->get();
|
|
|
- }else{
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
+ ->offset($placeid)
|
|
|
+ ->limit($data['pagesize'])->get();
|
|
|
+ } else {
|
|
|
$result = Article::where($where)
|
|
|
- ->whereIn('level',$level)
|
|
|
- ->offset($placeid)
|
|
|
- ->orderBy("updated_at","desc")
|
|
|
- ->limit($data['pagesize'])->get();
|
|
|
- }
|
|
|
+ ->whereIn('level', $level)
|
|
|
+ ->offset($placeid)
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
+ ->limit($data['pagesize'])->get();
|
|
|
+ }
|
|
|
}
|
|
|
if (empty($result)) {
|
|
|
return Result::error("此栏目暂无相关新闻", 0);
|
|
@@ -598,10 +624,10 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- ->orderBy("updated_at", "desc")
|
|
|
- ->limit($data['pageSize'])
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- ->get();
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ ->get();
|
|
|
|
|
|
$count = Article::where(function ($query) use ($where) {
|
|
|
foreach ($where as $condition) {
|
|
@@ -654,16 +680,16 @@ class NewsService implements NewsServiceInterface
|
|
|
*/
|
|
|
public function getWebsiteSurvey(array $data): array
|
|
|
{
|
|
|
- if(isset($data['website_id']) && !empty($data['website_id'])){
|
|
|
- $website = Website::where('id',$data['website_id'])->first();
|
|
|
- if(empty($website)){
|
|
|
- return Result::error("暂无此网站",0);
|
|
|
+ if (isset($data['website_id']) && !empty($data['website_id'])) {
|
|
|
+ $website = Website::where('id', $data['website_id'])->first();
|
|
|
+ if (empty($website)) {
|
|
|
+ return Result::error("暂无此网站", 0);
|
|
|
}
|
|
|
}
|
|
|
- if(isset($data['art_id']) && !empty($data['art_id'])){
|
|
|
- $article = Article::where('id',$data['art_id'])->where('status',1)->first();
|
|
|
- if(empty($article)){
|
|
|
- return Result::error("暂无此文章",0);
|
|
|
+ if (isset($data['art_id']) && !empty($data['art_id'])) {
|
|
|
+ $article = Article::where('id', $data['art_id'])->where('status', 1)->first();
|
|
|
+ if (empty($article)) {
|
|
|
+ return Result::error("暂无此文章", 0);
|
|
|
}
|
|
|
// return Result::error($data,0);
|
|
|
$where['art_id'] = $data['art_id'];
|
|
@@ -677,14 +703,14 @@ class NewsService implements NewsServiceInterface
|
|
|
$where['sur_id'] = $survey['sur_id'];
|
|
|
// $query = ArticleSurvey::where('sur_id',$survey['sur_id']);
|
|
|
}
|
|
|
- $result['survey'] = ArticleSurvey::where($where)->where('is_other',0)
|
|
|
- ->leftJoin('article','article_survey.art_id','article.id')
|
|
|
- ->select('article_survey.*','article.survey_type')
|
|
|
- ->get()->all();
|
|
|
- $result['other'] = ArticleSurvey::where($where)->where('is_other',1)->where('other_id',0)->first();
|
|
|
- $result['others'] = ArticleSurvey::where($where)->where('is_other',1)->where('other_id','!=',0)->orderByDesc('created_at')->first();
|
|
|
- if(empty($result)){
|
|
|
- return Result::error("此文章暂无调查问卷",0);
|
|
|
+ $result['survey'] = ArticleSurvey::where($where)->where('is_other', 0)
|
|
|
+ ->leftJoin('article', 'article_survey.art_id', 'article.id')
|
|
|
+ ->select('article_survey.*', 'article.survey_type')
|
|
|
+ ->get()->all();
|
|
|
+ $result['other'] = ArticleSurvey::where($where)->where('is_other', 1)->where('other_id', 0)->first();
|
|
|
+ $result['others'] = ArticleSurvey::where($where)->where('is_other', 1)->where('other_id', '!=', 0)->orderByDesc('created_at')->first();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("此文章暂无调查问卷", 0);
|
|
|
}
|
|
|
return Result::success($result);
|
|
|
}
|
|
@@ -735,11 +761,11 @@ class NewsService implements NewsServiceInterface
|
|
|
*/
|
|
|
public function addWebsiteSurveyVote(array $data): array
|
|
|
{
|
|
|
-
|
|
|
- if(isset($data['website_id']) && !empty($data['website_id'])){
|
|
|
- $website = Website::where('id',$data['website_id'])->first();
|
|
|
- if(empty($website)){
|
|
|
- return Result::error("暂无此网站",0);
|
|
|
+
|
|
|
+ if (isset($data['website_id']) && !empty($data['website_id'])) {
|
|
|
+ $website = Website::where('id', $data['website_id'])->first();
|
|
|
+ if (empty($website)) {
|
|
|
+ return Result::error("暂无此网站", 0);
|
|
|
}
|
|
|
if (isset($data['sur_id']) && !empty($data['sur_id'])) {
|
|
|
$survey = ArticleSurvey::where('sur_id', $data['sur_id'])->where('website_id', $data['website_id'])->pluck('sur_id');
|
|
@@ -766,19 +792,19 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
}
|
|
|
// return Result::success($data['choice_id']);
|
|
|
- $other = ArticleSurvey::whereIn('id',$data['choice_id'])
|
|
|
- ->where('website_id',$data['website_id'])
|
|
|
- ->where('is_other',1)
|
|
|
- ->where('other_id',0)
|
|
|
- ->first();
|
|
|
- if(!empty($other)){
|
|
|
- return Result::error("请选择已有的选项!",0);
|
|
|
+ $other = ArticleSurvey::whereIn('id', $data['choice_id'])
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->where('is_other', 1)
|
|
|
+ ->where('other_id', 0)
|
|
|
+ ->first();
|
|
|
+ if (!empty($other)) {
|
|
|
+ return Result::error("请选择已有的选项!", 0);
|
|
|
}
|
|
|
- $choice['other'] = ArticleSurvey::whereIn('id',$data['choice_id'])
|
|
|
- ->where('website_id',$data['website_id'])
|
|
|
- ->where('is_other',1)
|
|
|
- ->where('other_id','!=',0)
|
|
|
- ->first();
|
|
|
+ $choice['other'] = ArticleSurvey::whereIn('id', $data['choice_id'])
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->where('is_other', 1)
|
|
|
+ ->where('other_id', '!=', 0)
|
|
|
+ ->first();
|
|
|
// return Result::success($data);
|
|
|
if (!empty($choice['other'])) {
|
|
|
array_push($data['choice_id'], $choice['other']['other_id']);
|
|
@@ -948,82 +974,81 @@ class NewsService implements NewsServiceInterface
|
|
|
public function getSurveyList(array $data): array
|
|
|
{
|
|
|
$where = [];
|
|
|
- if(isset($data['survey_name']) &&!empty($data['survey_name'])){
|
|
|
- array_push($where,['survey_name','like','%'.$data['survey_name'].'%']);
|
|
|
+ if (isset($data['survey_name']) && !empty($data['survey_name'])) {
|
|
|
+ array_push($where, ['survey_name', 'like', '%' . $data['survey_name'] . '%']);
|
|
|
}
|
|
|
- if(isset($data['survey_type']) && $data['survey_type'] != null){
|
|
|
- array_push($where,['survey_type','=',$data['survey_type']]);
|
|
|
+ if (isset($data['survey_type']) && $data['survey_type'] != null) {
|
|
|
+ array_push($where, ['survey_type', '=', $data['survey_type']]);
|
|
|
}
|
|
|
- if(isset($data['is_survey']) && $data['is_survey'] != null){
|
|
|
- array_push($where,['is_survey','=',$data['is_survey']]);
|
|
|
+ if (isset($data['is_survey']) && $data['is_survey'] != null) {
|
|
|
+ array_push($where, ['is_survey', '=', $data['is_survey']]);
|
|
|
}
|
|
|
// return Result::success($where);
|
|
|
- if(!empty($where)){
|
|
|
+ if (!empty($where)) {
|
|
|
$query = Article::where($where)->whereNotNull('survey_name');
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$query = Article::whereNotNull('survey_name');
|
|
|
}
|
|
|
$count = $query->count();
|
|
|
$survey = $query->orderByDesc('id')
|
|
|
- ->limit($data['pageSize'])
|
|
|
- ->offset(($data['page']-1)*$data['pageSize'])
|
|
|
- ->get();
|
|
|
- if(empty($survey->toArray())){
|
|
|
- return Result::error("暂无调查问卷!",0);
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ ->get();
|
|
|
+ if (empty($survey->toArray())) {
|
|
|
+ return Result::error("暂无调查问卷!", 0);
|
|
|
}
|
|
|
$result = [
|
|
|
- 'rows'=>$survey,
|
|
|
- 'count'=>$count
|
|
|
+ 'rows' => $survey,
|
|
|
+ 'count' => $count,
|
|
|
];
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
/**
|
|
|
* 后端-获取网站调查问卷详情
|
|
|
* @param array $data
|
|
|
- * @return array
|
|
|
+ * @return array
|
|
|
*/
|
|
|
public function getSurveyInfo(array $data): array
|
|
|
{
|
|
|
- if(isset($data['sur_id']) &&!empty($data['sur_id'])){
|
|
|
- $where = [ 'sur_id'=>$data['sur_id']];
|
|
|
- $choose = ArticleSurvey::where($where)->where('is_other',0)
|
|
|
- ->leftJoin('article','article_survey.art_id','article.id')
|
|
|
- ->select('article_survey.*','article.survey_type')
|
|
|
- ->get()->all();
|
|
|
- if(empty($choose)){
|
|
|
- return Result::error("此调查问卷不存在",0);
|
|
|
+ if (isset($data['sur_id']) && !empty($data['sur_id'])) {
|
|
|
+ $where = ['sur_id' => $data['sur_id']];
|
|
|
+ $choose = ArticleSurvey::where($where)->where('is_other', 0)
|
|
|
+ ->leftJoin('article', 'article_survey.art_id', 'article.id')
|
|
|
+ ->select('article_survey.*', 'article.survey_type')
|
|
|
+ ->get()->all();
|
|
|
+ if (empty($choose)) {
|
|
|
+ return Result::error("此调查问卷不存在", 0);
|
|
|
}
|
|
|
- $resultsArray = array_column($choose, 'results');
|
|
|
+ $resultsArray = array_column($choose, 'results');
|
|
|
$total = array_sum($resultsArray);
|
|
|
- $other = ArticleSurvey::where($where)->where('is_other',1)->where('other_id',0)->first();
|
|
|
- $others = ArticleSurvey::where($where)->where('is_other',1)->where('other_id','!=',0)->orderByDesc('created_at')->get()->all();
|
|
|
+ $other = ArticleSurvey::where($where)->where('is_other', 1)->where('other_id', 0)->first();
|
|
|
+ $others = ArticleSurvey::where($where)->where('is_other', 1)->where('other_id', '!=', 0)->orderByDesc('created_at')->get()->all();
|
|
|
// $total = 0;
|
|
|
- if(!empty($other)){
|
|
|
+ if (!empty($other)) {
|
|
|
$total = $total + $other['results'];
|
|
|
- $other['choice_name'] = $other['choice_name'].'(其他)';
|
|
|
- if(!empty($others)){
|
|
|
+ $other['choice_name'] = $other['choice_name'] . '(其他)';
|
|
|
+ if (!empty($others)) {
|
|
|
$other['hasChildren'] = true;
|
|
|
// array_push($other,['hasChildren','=',true]);
|
|
|
$other['children'] = $others;
|
|
|
$other_choices = [$other->toArray()];
|
|
|
- $mer_choice = array_merge($choose,$other_choices);
|
|
|
+ $mer_choice = array_merge($choose, $other_choices);
|
|
|
$value_choice = array_values($mer_choice);
|
|
|
- }
|
|
|
- else{
|
|
|
+ } else {
|
|
|
// return Result::error('1111');
|
|
|
$other_choices = [$other->toArray()];
|
|
|
- $other_choices = array_merge($choose,$other_choices);
|
|
|
+ $other_choices = array_merge($choose, $other_choices);
|
|
|
$value_choice = array_values($other_choices);
|
|
|
// return Result::success($result);
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$value_choice = $choose;
|
|
|
}
|
|
|
$result = [
|
|
|
- 'choose'=>$value_choice,
|
|
|
- 'total'=>$total
|
|
|
+ 'choose' => $value_choice,
|
|
|
+ 'total' => $total,
|
|
|
];
|
|
|
}
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
-}
|
|
|
+}
|