| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace App\Models\Char;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use App\Models\Char\CharBase;
- class CharCashItem_OutputBox extends Model
- {
- protected $connection = "Char";
- protected $table = "Table_CharCashItem_OutputBox";
- protected $primaryKey = "ItemDBIndex";
- protected $dates = ["CreateDate", "DeleteDate"];
- protected $fillable =
- [
- "ItemDBIndex",
- "Owner",
- "Kind",
- "RecId",
- "Amount",
- "strChargeNo",
- "Deleted",
- "CreateDate",
- "DeleteDate",
- "GaveCharName",
- "Confirm",
- "Period",
- "Price",
- "evPType",
- "Comment"
- ];
- public $timestamps = false;
- public static function SENDITEMOUTPUTBOX($request)
- {
- if ($request['Owner'] == "") {
- $chars = CharBase::get();
- foreach ($chars as $char) {
- if ($char->Online == 1) {
- $send = new CharCashItem_OutputBox();
- $send->Owner = $char->DBKey;
- $send->Kind = $request['Kind'];
- $send->RecId = trim(strtolower($request['RecId']));
- $send->Amount = $request['Amount'];
- $send->strChargeNo = "*";
- $send->Deleted = 0;
- $send->CreateDate = now();
- $send->DeleteDate = now();
- $send->GaveCharName = "*";
- $send->Confirm = 0;
- $send->Period = $request['Period'];
- $send->Price = 0;
- $send->evPType = $request['evPType'];
- $send->Comment = $request['Comment'];
- $send->save();
- }
- }
- } else {
- $send = new CharCashItem_OutputBox();
- $send->Owner = $request['Owner'];
- $send->Kind = $request['Kind'];
- $send->RecId = trim(strtolower($request['RecId']));
- $send->Amount = $request['Amount'];
- $send->strChargeNo = "*";
- $send->Deleted = 0;
- $send->CreateDate = now();
- $send->DeleteDate = now();
- $send->GaveCharName = "*";
- $send->Confirm = 0;
- $send->Period = $request['Period'];
- $send->Price = 0;
- $send->evPType = $request['evPType'];
- $send->Comment = $request['Comment'];
- $send->save();
- }
- }
- }
|