Skip to content

Instantly share code, notes, and snippets.

@caingougou
caingougou / DatabaseDiffGenerator.php
Last active May 14, 2024 19:02
Automatically generate a migration for current changes in local database
<?php
namespace App\Console\Commands;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class DatabaseDiffGenerator extends Command {
/**
* The name and signature of the console command.
@caingougou
caingougou / setup.sh
Created April 16, 2024 02:34
设置composer platform php 版本
composer config platform.php 8.0.7
@caingougou
caingougou / Product.php
Last active February 18, 2024 13:23
只有在 updating 和 updated 中 decrement 和 increment 才会触发
<?php
class Product extends Model {
public static function boot() {
parent::boot();
static::updating(function ($model) {
// 只有在 updating 和 updated 中 decrement 和 increment 才会触发
});
}
@caingougou
caingougou / list_settings.json
Created September 8, 2023 06:37
list_settings.json
{
"Successful": true,
"ErrorMessage": null,
"Logined": true,
"ReturnData": {
"Response": {
"SchemaCode": "D279408f4e98debcacb41dfb8c64ba7928558d0",
"DisplayName": "供应商管理",
"Axis": "CreatedTime",
"AxisSortDirection": 1,
@caingougou
caingougou / .php-cs-fixer.php
Last active December 8, 2023 04:12
my php cs xift
<?php
return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
'class_attributes_separation' => ['elements' => ['method' => 'one', ]],
'multiline_whitespace_before_semicolons' => false,
@caingougou
caingougou / Noah.http
Last active March 10, 2023 09:38
Noah request collections
@token = Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6IjQ1MDlkYWY1LTk4YjAtNGZlYS1hYmYwLTNiN2RjOTgzYzk1ZCIsInVzZXJuYW1lIjoiYWRtaW4ifQ.LU74e1xMlJWwJAxahPwHmH77rUGlMc18cY4uIsA_Cobvcah7jWEGObvFP0vqnzJHBmAt5jQU67AGLiidaD-lfA
# * 为新开发
# lexiconType
## - 1 domain
## - 2 extract
## - 3 crawl
## - 4 saas
@caingougou
caingougou / serve_excel.py
Created January 4, 2022 10:39
Serve Excel content as json api
from http.server import HTTPServer, BaseHTTPRequestHandler
import socket
import errno
import json
import openpyxl
from collections import OrderedDict
from itertools import islice
import sys
workbook = openpyxl.Workbook()
min(max(Carbon::createFromDate(2021, 9, 8)->diffInDays(today(), true), 0), 3)
@caingougou
caingougou / api.txt
Last active March 22, 2021 10:20
api.md
# @host = localhost:8000
@host = fission.demos.kai-dian.com
### 使用手机号+密码登录
# @name login
POST http://{{host}}/adminapi/merchant/login
Content-Type: application/json
{
"mobile": "18101655878",
@caingougou
caingougou / OrderDetail.tsx
Created May 8, 2020 03:57
OrderDetail.tsx
import Taro, { Component, Config } from '@tarojs/taro';
import { View, Text, Image, ScrollView, Button } from '@tarojs/components';
import './OrderDetail.scss'
import { AtButton, AtFloatLayout, AtToast, AtModal, AtModalContent } from 'taro-ui';
import { getOrderDetail, cancelOrder, deleteOrder, updateOrderAddress, payOrder, confirmOrder } from '../../../servers/servers'
import { ORDER_STATUS, REFUND_STATUS, REFUND_TYPE } from '../../../global/global_data'
import Network from '../../../components/Network'
import Loading from '../../../components/Loading'
import classNames from 'classnames'