5 changed files with 120 additions and 14 deletions
-
38app/Admin/Controllers/StoreUserReportController.php
-
35app/Admin/Repositories/StoreUserReport.php
-
5app/Models/ImsCjdcStore.php
-
53app/Models/StoreAccount.php
-
3resources/lang/zh-CN/store-user-report.php
@ -0,0 +1,53 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace App\Models; |
|||
|
|||
|
|||
|
|||
|
|||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
|||
use Illuminate\Database\Eloquent\Model; |
|||
use Illuminate\Support\Facades\DB; |
|||
use App\Models\ImsCjdcStore as storeModel; |
|||
|
|||
class StoreAccount extends Model |
|||
{ |
|||
use HasDateTimeFormatter; |
|||
protected $table = 'ims_cjdc_store_account'; |
|||
protected $dateFormat = 'U'; |
|||
public $timestamps = false; |
|||
|
|||
/** |
|||
* 添加店铺流水 |
|||
* @param $oid //主订单id
|
|||
*/ |
|||
public function addStoreAccount($oid,$type=1,$note='线上订单') |
|||
{ |
|||
$accountData = $data = []; |
|||
$orderData = DB::table('ims_cjdc_order')->where('order_main_id',$oid)->get()->toArray(); |
|||
|
|||
if (count($orderData)) { |
|||
foreach ($orderData as $item) { |
|||
if (is_object($item)){ |
|||
$accountData['user_id'] = $item->user_id; |
|||
$accountData['order_id'] = $item->id; |
|||
$accountData['store_id'] = $item->store_id; |
|||
$accountData['money'] = $item->money; |
|||
$accountData['type'] = $type; |
|||
$accountData['note'] = $note; |
|||
$accountData['add_time'] = time(); |
|||
$accountData['time'] = date('Y-m-d H:i:s', time()); |
|||
$data[] = $accountData; |
|||
} |
|||
} |
|||
return DB::table('ims_cjdc_store_account')->insert($data); |
|||
} else { |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public function store(){ |
|||
return $this->hasMany(storeModel::class,'id','store_id'); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue