69 lines
2.9 KiB
PHP
69 lines
2.9 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers\Server\H5;
|
||
|
|
|
||
|
|
use App\Models\Contact;
|
||
|
|
use App\Models\Live\Anchor;
|
||
|
|
use App\Models\Server\MerchantInformation;
|
||
|
|
use Illuminate\Http\Request;
|
||
|
|
use App\Http\Controllers\Controller;
|
||
|
|
|
||
|
|
class ArticleController extends Controller
|
||
|
|
{
|
||
|
|
public function ufutxNewArticles(Request $request)
|
||
|
|
{
|
||
|
|
$articles =[];
|
||
|
|
$merchants = [];
|
||
|
|
if (config("app.env") == 'production') {
|
||
|
|
$m_ids = [44, 1059, 491];
|
||
|
|
foreach ($m_ids as $m_id) {
|
||
|
|
$articles[] = MerchantInformation::where('merchant_id', $m_id)->select('id', 'merchant_id', 'title', 'subTitle')->orderBy('created_at', 'desc')->first();
|
||
|
|
$merchants[] = Anchor::where('m_id', $m_id)->select('pic', 'name', 'm_id')->first();
|
||
|
|
}
|
||
|
|
// $article1 = MerchantInformation::where('merchant_id', 44)->select('id', 'merchant_id', 'title', 'subTitle')->orderBy('id', 'desc')->first();
|
||
|
|
// $article2 = MerchantInformation::where('merchant_id', 1059)->select('id', 'merchant_id', 'title', 'subTitle')->orderBy('id', 'desc')->first();
|
||
|
|
// $article3 = MerchantInformation::where('merchant_id', 491)->select('id', 'merchant_id', 'title', 'subTitle')->orderBy('id', 'desc')->first();
|
||
|
|
}else {
|
||
|
|
// $article1 = MerchantInformation::select('id', 'merchant_id', 'title', 'subTitle')->orderBy('id', 'desc')->first();
|
||
|
|
// $article2 = MerchantInformation::select('id', 'merchant_id', 'title', 'subTitle')->orderBy('id', 'desc')->first();
|
||
|
|
// $article3 = MerchantInformation::select('id', 'merchant_id', 'title', 'subTitle')->orderBy('id', 'desc')->first();
|
||
|
|
$m_ids = [1, 14, 18];
|
||
|
|
foreach ($m_ids as $m_id) {
|
||
|
|
$articles[] = MerchantInformation::where('merchant_id', $m_id)->select('id', 'merchant_id', 'title', 'subTitle')->orderBy('id', 'desc')->first();
|
||
|
|
$merchants[] = Anchor::where('m_id', $m_id)->select('pic', 'name', 'm_id')->first();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return $this->success('ok', ['articles'=>$articles, 'merchants'=>$merchants]);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function ufutxNewArticle(Request $request, $id)
|
||
|
|
{
|
||
|
|
$article = MerchantInformation::find($id);
|
||
|
|
return $this->success('ok', $article);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 友福同享报名人员联系信息
|
||
|
|
*/
|
||
|
|
public function ufutxContacts(Request $request){
|
||
|
|
$name = $request->name;
|
||
|
|
$mobile = $request->mobile;
|
||
|
|
if(!$name || !$mobile){
|
||
|
|
return $this->failure('姓名和手机号不能为空值');
|
||
|
|
}
|
||
|
|
if(preg_match("/^1[34578]\d{9}$/", $mobile) == false){
|
||
|
|
//return $this->failure('手机号不正确');
|
||
|
|
}
|
||
|
|
$contact = Contact::where('mobile',$mobile)->first();
|
||
|
|
if($contact){
|
||
|
|
return $this->success('ok');
|
||
|
|
}
|
||
|
|
$contact = new Contact();
|
||
|
|
$contact->name = $name;
|
||
|
|
$contact->mobile = $mobile;
|
||
|
|
$contact->save();
|
||
|
|
return $this->success('ok');
|
||
|
|
}
|
||
|
|
}
|